O_O
O_O

Reputation: 4477

Java - Adding directories to PATH?

I'm going through the Java EE 6 Tutorials and on page 68 under SDK Installation Tips, it says:

"After you install the GlassFish Server, add the following directories to your PATH to avoid having to specify the full path when you use commands:

as-install-parent/bin as-install/bin

How do you add these to the "PATH"? Is it the System Properties, Advanced tab, Environment Variables box that I need to edit inside? What if I already have other directories indicated in PATH already? Will the SDK get confused or does it not matter?

Upvotes: 1

Views: 3031

Answers (1)

Leonel
Leonel

Reputation: 29217

Is it the System Properties, Advanced tab, Environment Variables box that I need to edit inside?

That's one way, in Windows. In this case, if you have an open CMD window, you need to open a new one so that it will get the new settings.

What if I already have other directories indicated in PATH already?

The PATH variable is a list of directories separated by a semicolon. Simply add the semicolon and the new directory. Example:

C:\Program Files\Mercurial;C:\cygwin\bin

In an open CMD window, you can also use set:

set PATH=%PATH%;C:\glassfish\as-install-parent\bin;C:\glassfish\as-install\bin

In Unix, use export, and colons instead of semicolons.

export PATH=$PATH:/usr/glassfish/as-install-parent/bin:/usr/glassfish/as-install/bin

Of course, remember to replace C:\glassfish from my examples with the actual directory where you installed Glassfish.

One last thing, keep in mind this variable is only used by the operating system to find the executables in the bin folders; it's not used by Java nor Glassfish.

Upvotes: 4

Related Questions