Java Reference
In-Depth Information
In any case, once you've located the install directory for Java, you'll see a bin
directory in there. In that bin directory you'll see java , javac , jar , and a whole
bunch of other things. You'll need to add the full path for that bin directory
to your shell's PATH .
The PATH is a list of directories, separated by a colon (semicolon on Windows).
To change your PATH for the bash shell that we're using, follow these steps: 5
1.
In the shell, navigate to your home directory by typing cd , by itself. Confirm
the full path of your home directory by typing pwd .
2.
Using your text editor, create or edit the bash startup file in your home
directory. Normally this will be a file named .profile or .bash_profile in your
home directory (note the leading dot). On Windows using BusyBox, you
have to use .profile . Otherwise you should use .bash_profile . ls won't normally
show files with a leading dot, but ls-a will show it if the file already exists.
You may need to create it from scratch, and that's okay.
3.
Add a line to the file to modify the PATH setting, adding Java's bin directory,
separated by a colon (:)—or a semicolon (;) on Windows.
For example, on Linux or Mac, if my JDK was installed in /opt/local/java , I'd add
a line to .bash_profile that said
export PATH="$PATH:/opt/local/java/bin:"
On Windows, you need to change the backslashes to slashes and use semi-
colons instead of colons, so if Java's installed in C:\ProgramFiles\Java\jdk1.7.0_67\bin
(which is Windows style) you add a line to .profile that says this, in POSIX style:
export PATH="$PATH;C:/Program Files/Java/jdk1.7.0_67/bin;"
Save and close the file, then close and reopen your command-line windows
to pick up the new settings.
Seriously—you have to close all your open command-line windows and reopen
them for this to take effect.
To check your path and see if your new setting worked, type this:
$ echo $PATH
You should see your new entry that includes Java's bin .
5.
If you run into trouble with this method, especially with Windows, take a look at
http://www.java.com/en/download/help/path.xml .
 
 
 
Search WWH ::




Custom Search