Ok, I finally found out where to update the new JDK I installed into linux (/etc/bashrc). Thanks to all for all the suggestions.
I now get 1.5.0_08 with a java -version at the linux prompt.
The huge problem remains, however, that if I start the browser with a out.println("Version = " + System.getProperty('java.version') command, I still get 1.4.2.
All the environment variables seem to be correct. I've also restarted both apache and tomcat.
Here are the environment variables:
JAVA_HOME = /usr/java/1.5.0_08 CLASSPATH => points to Java 5, not 1.4.2 CATALINA_HOME -> points to Tomcat 5.0.3x
Clearly, I'm still missing something simple (hopefully), right?
What do I need to do to finally tell Tomcat under Linux to use the new JDK?
Thanks again in advance.
-- Mike
[ EJFH: Removed inadvertent "strikethrough" that may have been intended as an emoticon. ] [ September 14, 2006: Message edited by: Ernest Friedman-Hill ]
Ernest Friedman-Hill
,
author and iconoclast
staff
Restarted it how -- how is it running? Via an /etc/init.d script, or just launched by hand? If it's via an init script, you should go look at that file and make sure it's not setting JAVA_HOME for you.
I have to admit that precisely which files bash reads when it starts up, and in what order, is something of a mystery to me, mainly because the answer is totally different depending on whether bash is started as a login shell, an interactive non-login shell, a non-interactive shell, and whether the UID and EUID are equal or unequal! As a result, this is only a gut feeling rather than an absolute fact, but my guess is that /etc/bashrc won't be read by an init script, and adding the appropriate JAVA_HOME definition to /etc/profile will fix this problem.
Tomcat is running automatically. I've restarted it several times using a tool called "Web Host Manager", but that has no effect on the version displayed (1.4.2).
Based on your suggestion, I tried to add the line in /etc/profile like this:
I wanted to point a few things 1) If you are updating your JVM you should update it for all apps (read for the whole system) provided you won't break something you need like browser plug ins. The reason for that is that you wish to keep current with security patches distributed by your distro of choice when they become available and save yourself the time of reinstalling and reconfiguring again and again after each patch. 2) Tomcat if setup "properly" runs under a separate user in most cases named tomcat too, that is where the environment vars should be changed. Most distributions will use start up scripts to set up the environment for all users before the machine reaches the final runlevel 5 for the X server GUI logins. Also your java version would be linked to something like /usr/bin/java which would point to the currently installed version /usr/local/share/java-XXXX making a change like the one you just did will possibly break that which means that unless you specify the correct path you will be running the wrong JVM version.
Yes I agree linux can seem like a mess but nonetheless pretty much everything is in text files, you can use a find, and follows some pretty good logic for those in the know (which is also ever changing ).
I have been running Tomcat for a while and some operations are a pain so I hope this helps a little bit for future endeavors. George
The problem getting the browser part of the server updated was that the JAVA_HOME was being set both in the /etc/bashrc and also in the starttomcat shell sript (oops!). Thus, when tomcat loaded it referred to the old JVM. Changing this variable to /usr/java1.5.0_08 fixed the problem.
Thanks again for your reply.
-- Mike
Post by:autobot
Grow your own food... or this tiny ad:
a bit of art, as a gift, the permaculture playing cards