LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

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

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


Hello,
I have a problem to run some java application scripts after the automatic update of Sun's JRE from 1.6.0.13 to 1.6.0.14. 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-1.6.0.13/bin/java: No such file or directory

which makes sense, as the new installed version is 1.6.0.14.
Executing:
Code:
java -version
gives me the correct version number.
However,
Code:
echo $JAVA_HOME
still points to /usr/lib/jvm/java-6-sun-1.6.0.13

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

Rep: Reputation: 31
Post

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

Code:
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.14/
----
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:

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

Code:
lrwxrwxrwx 1 root root   21 2009-03-04 15:56 currentjava -> /usr/lib/jvm/java-6-sun-1.6.0.14/
drwxr-xr-x 8 root root 4096 2009-03-04 15:55 java-6-sun-1.6.0.14
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 07:23 PM.
 
  


Reply

Tags
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 05:15 PM
Update Apache2 to the latest version on Debian. elvisious Linux - Software 1 06-12-2009 07:59 PM
I Can't Install Latest Version Of Java Without Installing Firefox - Help! davidx Linux - Software 2 10-16-2008 12:19 AM
Need to update basic sys install to latest version snowywar Linux - Server 3 12-21-2006 06:30 AM
Need to update basic sys install to latest version snowywar Linux - Server 1 12-06-2006 10:50 AM


All times are GMT -5. The time now is 09:40 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