LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Please help! I still can not set JAVA path (https://www.linuxquestions.org/questions/linux-software-2/please-help-i-still-can-not-set-java-path-102717/)

preswang 10-11-2003 03:44 AM

Please help! I still can not set JAVA path
 
I have searched many thread and followed the instruction:
I installed the JAVA2SE in usr/java/j2sdk1.4.2_01

so I gedit .bash_profile add
:/usr/java/j2sdk1.4.2_01/bin to the end of PATH

can not work

and tried gedit .bashrc add
export PATH = $PATH:/usr/java/j2sdk1.4.2_01/bin

also can not help me to type java(in /home/preswang) to run.
I confused, does anyone help me, please....!

in /usr/java/j2sdk1.4.2_01/bin
type ./java
it runs

megaspaz 10-11-2003 03:50 AM

you could try to pathmunge it globally by editing /etc/profile.

Code:

# Path manipulation
if [ `id -u` = 0 ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
fi

pathmunge /usr/X11R6/bin after

JAVA_HOME=/usr/java/j2sdk1.4.1_01
pathmunge $JAVA_HOME/bin after
export JAVA_HOME

i don't know if placement of the last 3 lines matters, but sticking the last 3 lines under the last "pathmunge" works for me. and delete the those lines you put in .bashrc or .bash_profile.

if this doesn't work, you may have to logout/login ( or reboot.... :scratch: ).

preswang 10-11-2003 04:00 AM

I have tried to put $PATH=$PATH:/usr/java/j2sdk1.4.2_01/bin in the /etc/profile
can not work!

and do what you told me to do, also fail. I restart my laptop now!

preswang 10-11-2003 04:06 AM

After reboot, it works :) But I am confuse now that LINUX need reboot to set PATH ?

Crashed_Again 10-11-2003 04:25 AM

It has to read /etc/profile to set the new path. If you opened up a new shell you would have seen the changes take effect.

shycalais 10-17-2003 03:56 AM

if i open up a new shell it doesn't seem to work either, tried to reboot as well, same thing.. no fireworks :( any suggestions?

megaspaz 10-17-2003 04:06 AM

what exactly did you do? type in a shell terminal:

java -version

if you get a java version output, then java is installed and the path is fine. if you get something like command not found, then you need to trace what you did. how did you install java? did you use the rpm from sun's java website? did you make sure that you didn't make any typos when setting/exporting the path to the java installation directory? need to know what you did.

shycalais 10-17-2003 04:18 AM

:) wrong version in profile, 1.4.1 instead of 1.4.2 :)
thanks megaspaz :)

yapp 10-17-2003 04:26 AM

Quote:

Originally posted by preswang
After reboot, it works :) But I am confuse now that LINUX need reboot to set PATH ?
If it was set in your boot scripts perhaps, but I doubt that.

If a profile (shell login) script was updated, type "source /etc/profile" to execute the script again in your current shell.

shycalais 11-01-2003 08:51 PM

:) much thanks! it was already running! no scripts needed! it boots on startup! thats why it wouldn't let me start up a server (it was already running) :)

thanks again to everyone! i'm now running through a tutorial!

if anyone else wants the link to this very good tutorial! just let me know and i'll post it up!!


All times are GMT -5. The time now is 09:10 AM.