LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-11-2003, 03:44 AM   #1
preswang
Member
 
Registered: Oct 2003
Location: UK/Chinese
Distribution: Slackware9.1
Posts: 55

Rep: Reputation: 15
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
 
Old 10-11-2003, 03:50 AM   #2
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
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.... ).

Last edited by megaspaz; 10-11-2003 at 04:06 AM.
 
Old 10-11-2003, 04:00 AM   #3
preswang
Member
 
Registered: Oct 2003
Location: UK/Chinese
Distribution: Slackware9.1
Posts: 55

Original Poster
Rep: Reputation: 15
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!
 
Old 10-11-2003, 04:06 AM   #4
preswang
Member
 
Registered: Oct 2003
Location: UK/Chinese
Distribution: Slackware9.1
Posts: 55

Original Poster
Rep: Reputation: 15
After reboot, it works But I am confuse now that LINUX need reboot to set PATH ?
 
Old 10-11-2003, 04:25 AM   #5
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
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.
 
Old 10-17-2003, 03:56 AM   #6
shycalais
Member
 
Registered: Sep 2003
Distribution: rh
Posts: 43

Rep: Reputation: 15
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?
 
Old 10-17-2003, 04:06 AM   #7
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
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.
 
Old 10-17-2003, 04:18 AM   #8
shycalais
Member
 
Registered: Sep 2003
Distribution: rh
Posts: 43

Rep: Reputation: 15
wrong version in profile, 1.4.1 instead of 1.4.2
thanks megaspaz
 
Old 10-17-2003, 04:26 AM   #9
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Rep: Reputation: 30
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.
 
Old 11-01-2003, 08:51 PM   #10
shycalais
Member
 
Registered: Sep 2003
Distribution: rh
Posts: 43

Rep: Reputation: 15
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!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot set the path for java jgoggel Programming 2 07-23-2004 06:31 AM
Java can't find package, but PATH set correctly (j2se1.4.0, java.util.regex package) Ethan Programming 5 02-06-2004 09:55 PM
set up path,classpath in linux(slaware9) for java Manjula.S Linux - Software 5 10-06-2003 11:38 PM
how to rum java on linux and set path for the same mita_majumdar Linux - Newbie 2 06-02-2003 12:50 AM
how to rum java on linux and set path for the same mita_majumdar Linux - Newbie 1 05-26-2003 03:29 AM


All times are GMT -5. The time now is 07:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration