jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes Best way to set Java_Home in linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Best way to set Java_Home in linux" Watch "Best way to set Java_Home in linux" New topic
Author

Best way to set Java_Home in linux

riyas nedumpurath
Greenhorn

Joined: Jun 28, 2009
Posts: 14
I installed jdk in ubuntu linux 9.04 last week. Following a post in a forum, I changed bash_profile file to add JAVA_HOME and PATH as last line. When I restarted the system, i had the horror of system not booting. I had to reinstall the OS. Can anybody explain a safe way to do this???
Thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36579
    
  16
The way I did it was to edit ~/.bashrc, adding the following line:
export PATH=/usr/java/jdk1.6.0_14/bin/:.:$PATH
Note I addded a . as well, so I can call en executable in the same directory without writing "./xxx". You can write the same line as a command whenever you open a shell; then you can alter the JDK version used for different shells.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way to set Java_Home in linux
 
Similar Threads
different command-line startup on linux (vs. windows) not working
Linux installation help
how to define JAVA_HOME and similar sys variable in linux ?
fatal error : jni.h when runnin make/make-sheduler
Unable to take heap dump, when exceuting this command(jmap -heap:format=b <process id of jboss>)