• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in Configure JAVA in Linux  RSS feed

 
Nitin Kalra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Java peoples,
I am new person for linux.
I install java1.4 in RedHat Linux8.0 and set the path in profile file of /etc directory of linux.
PATH=/usr/java/j2sdk1.4.0_01/bin:$PATH
JAVA_HOME=/usr/java/j2sdk1.4.0_01
export PATH JAVA_HOME ...
When I compile one java file it will gives the error
bash: javac: command not found
Please give the suggustion to configure the java in linux
Thanks in advance,
 
Cindy Li
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you try other shells, e.g. Bourne shell, Ksh
or csh.
To verify if PATH is set properly, try
$ echo $PATH
Another possible reason, you might need to modify
/.profile and insert the setting in this file and
restart you machine. The PATH will then be set permanently.
I am seeing the light ...
 
Nitin Kalra
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your information
 
Brian Chen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.go to your login home directory.
->cd ~
2.use editor for example vi to edit the bash user profile.
->vi .bash_profile
3.add the jdk PATH and JAVA_HOME parameter
->PATH="/usr/jdk1.xx.x/bin":$PATH:$HOME/bin
JAVA_HOME="/usr/jdk1.xx.x"
EXPORT PATH JAVA_HOME
4.relogin the bash shell
5.test and verify the environment
->echo $JAVA_HOME
echo $PATH
enjoy!
 
Tim Holloway
Saloon Keeper
Posts: 18799
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: Linux is CASE sensitive, so it's not EXPORT, it's export.
I prefer the following as being slightly easier to maintain:
JAVA_HOME=/usr/java/jdknnnn
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME
"jdknnnn" represents the name of the JDK directory you want to use. Whether you prepend or postpend the java path to the other paths is up to you. It's actually a bit better to say "$JAVA_HOME/bin:$PATH", since no older JDKs are going to sneak in ahead of you.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitin Kalra:
Hi Java peoples,
I am new person for linux.
I install java1.4 in RedHat Linux8.0 and set the path in profile file of /etc directory of linux.
PATH=/usr/java/j2sdk1.4.0_01/bin:$PATH
JAVA_HOME=/usr/java/j2sdk1.4.0_01
export PATH JAVA_HOME ...
When I compile one java file it will gives the error
bash: javac: command not found
Please give the suggustion to configure the java in linux
Thanks in advance,

Be sure to log out completely and log back in before you try to run javac.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!