Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-23-2009, 05:03 PM   #1
LQ Newbie
Registered: Jul 2009
Posts: 1

Rep: Reputation: 0
Setting JAVA_HOME after automatic update of Java to the latest version

I have a problem to run some java application scripts after the automatic update of Sun's JRE from to More specifically, I run a script that initializes the application, setting the variables it uses. I get the following error:

line 93: /usr/lib/jvm/java-6-sun- No such file or directory

which makes sense, as the new installed version is
java -version
gives me the correct version number.
still points to /usr/lib/jvm/java-6-sun-

Anyone knows how to change this?
Old 07-23-2009, 06:21 PM   #2
Registered: Apr 2005
Location: Canada
Distribution: Slackware
Posts: 496

Rep: Reputation: 31

Just edit your ~/.bashrc file, and add the line defining your JAVA_HOME variable, such as:

export JAVA_HOME=/usr/lib/jvm/java-6-sun-
Also a handy way to avoid update problems in the future is to create a symbolic link to your java folder. Basically you point all your variables to a "shortcut", and then you only have to update that shortcut to point to the newest java version, instead of going through all your config files and IDEs to try to find where you defined the java folder. Let me demonstrate what I mean, since I don't think that came off as clear...

Navigate to the parent directory of your java folder, and then run:

ln -s /usr/lib/jvm/java-6-sun- currentjava
Then if you do an "ls -l" in that directory you'll see something resembling:

lrwxrwxrwx 1 root root   21 2009-03-04 15:56 currentjava -> /usr/lib/jvm/java-6-sun-
drwxr-xr-x 8 root root 4096 2009-03-04 15:55 java-6-sun-
And now you can point your JAVA_HOME to /usr/lib/jvm/currentjava/, and then just relink it to the newer version whenever an update is released, which as I said is easier than going through all your config files and updated the path manually.

Last edited by Vgui; 07-23-2009 at 06:23 PM.


java, javahome, jre

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to install latest Java version in Crunchbang linux froginlinux Linux - Newbie 2 06-16-2009 04:15 PM
Update Apache2 to the latest version on Debian. elvisious Linux - Software 1 06-12-2009 06:59 PM
I Can't Install Latest Version Of Java Without Installing Firefox - Help! davidx Linux - Software 2 10-15-2008 11:19 PM
Need to update basic sys install to latest version snowywar Linux - Server 3 12-21-2006 05:30 AM
Need to update basic sys install to latest version snowywar Linux - Server 1 12-06-2006 09:50 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:50 AM.

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