Click to See Complete Forum and Search --> : setting PATH for J2SDK


sajchurchey
04-20-2003, 06:30 PM
How can I set the PATH variable permanently for my RH 9 and RH 7.3 systems so that it can find my JVM?

bwkaz
04-20-2003, 08:14 PM
That depends -- where did you install it to? ;)

It'll help if you can find the javac executable (with something like find /usr -name javac -- but be warned, this can take a while). If you've got a /usr/java directory, then starting find off in that directory will help a lot -- find /usr/java -name javac to start it off there instead.

sajchurchey
04-20-2003, 08:50 PM
I know where that is: /usr/java/j2sdk1.4.1_01/bin

bwkaz
04-21-2003, 09:59 AM
OK, now edit your PATH to contain that directory. Add a line to ~/.bash_profile and ~/.bashrc that reads:

export PATH=$PATH:/usr/java/j2sdk1.4.1_01/bin

And then log out and back in, and that should do it.

If you want to have this work for all users, edit /etc/profile and /etc/bashrc. The profile files are executed when you start a login shell, and the others (the bashrc ones) are executed when you start any other shell (like if you fire up xterm, it's bash process reads the bashrc file).

gfreehed
04-21-2003, 05:08 PM
you could also add the line into your /etc/profile file so that all users get the path.

sajchurchey
04-23-2003, 02:51 PM
I've always edited .bash_profile or /etc/profile but to no avail. Thanx for letting me know that it takes more than just one or two files to make this happen.

bigrigdriver
04-23-2003, 06:40 PM
Actually, there is no need to log out and back in. Use the bash dot operator, or the keyword source. If you choose to put the path statement in your .profile, use the dot command like so: . .profile (note: that's dot dotprofile). Use the source keyword like this: source .profile (source dotprofile). Has the same effect that logout and login would have, without the hassle.
This information provided curtesy of 'A Practical Guide to Linux'.