RVDowning Posted July 31, 2006 Report Share Posted July 31, 2006 On Mandriva 2006, trying to install jdk1.5 (used by Tomcat 5.5) with jdk 1.4 already installed. I try to add JAVA_HOME="/usr/java/jdk1.5.0_07" <br> export JAVA_HOME after the export statement in /etc/profile. However, logging out and back in, when I do echo $JAVA_HOME I still get /usr/lib/jdk-1.4.2_09. Any ideas on how to get it to point to the newer one? I was leaving jdk 1.4 there since some older java programs would need it. Does this have to be removed? [moved from Software by spinynorman] Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted July 31, 2006 Report Share Posted July 31, 2006 How is your line showing in /etc/profile? I'm assuming something like: export JAVA_HOME="/usr/java/jdk1.5.0_07" is that correct? If not, maybe try it this way, see how it works. Quote Link to comment Share on other sites More sharing options...
RVDowning Posted July 31, 2006 Author Report Share Posted July 31, 2006 Will have to get home so I can look at it again before I swear to it, but I think it is as follows: JAVA_HOME="/usr/java/jdk1.5.0_07" export JAVA_HOME I think I also tried it with just the one statement as you indicated, but with the same result. Could something later in the "chain" be changing it back? Confused..... Quote Link to comment Share on other sites More sharing options...
neddie Posted July 31, 2006 Report Share Posted July 31, 2006 Try looking in the files .bashrc and .bash_profile in your user directory. If those files are setting the JAVA_HOME then it'll overwrite what was in there earlier. You shouldn't have to remove 1.4. Quote Link to comment Share on other sites More sharing options...
RVDowning Posted July 31, 2006 Author Report Share Posted July 31, 2006 Following is the end of /etc/profile: export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH # following two lines added by rvd 07/29/2006 according to http://howtoforge.org/comment/reply/1264 JAVA_HOME="/usr/java/jdk1.5.0_07" export JAVA_HOME export HISTCONTROL HISTSIZE for i in /etc/profile.d/*.sh ; do if [ -x $i ]; then . $i fi done unset i Try looking in the files .bashrc and .bash_profile in your user directory. If those files are setting the JAVA_HOME then it'll overwrite what was in there earlier. You shouldn't have to remove 1.4. Well, .bash_profile reads: # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH unset USERNAME # startx .backrc reads: # .bashrc # User specific aliases and functions # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # enable programmable completion features if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi Quote Link to comment Share on other sites More sharing options...
neddie Posted July 31, 2006 Report Share Posted July 31, 2006 What about /etc/rc or /etc/rc.local - maybe they set it? It must be being set somewhere! How did you originally install 1.4? Quote Link to comment Share on other sites More sharing options...
RVDowning Posted July 31, 2006 Author Report Share Posted July 31, 2006 (edited) /etc/rc is added as an attachment. Too long to copy the text. Don't think I saw anythign there that seemed pertinent. /etc/rc.local contains: #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. # following is sensors-detect # I2C adapter drivers modprobe i2c-nforce2 modprobe i2c-isa # I2C chip drivers modprobe eeprom modprobe it87 # sleep 2 # optional /usr/bin/sensors -s # recommended # added by rvd because of udev problems service udev start touch /var/lock/subsys/local Seems to me that 1.4 was installed as part of the original Mandriva 2006 install. Don't think I did it separately. One would think there would be some standard place for the setting of a JAVA_HOME environment variable. Edited July 31, 2006 by RVDowning Quote Link to comment Share on other sites More sharing options...
pmpatrick Posted July 31, 2006 Report Share Posted July 31, 2006 Try resetting your JAVA_HOME in your ~/.bash_profile. That should work; the home .bash_profile overrides the global settings in /etc/profile and probably whatever else is resetting your JAVA_HOME as that appears to be what is occurring. Quote Link to comment Share on other sites More sharing options...
RVDowning Posted August 1, 2006 Author Report Share Posted August 1, 2006 What I ended up doing was: I went into /etc/profile.d directory and marked each java related file (sh and csh) as non-executable. These were 1.4.2 related. I then added files: jdk-1.5.0_07.sh with the following: export JAVA_HOME=/usr/java/jdk-1.5.0_07 export JDK_HOME=$JAVA_HOME export PATH="$PATH:$JAVA_HOME/bin" export MANPATH="$MANPATH:$JAVA_HOME/man" and jre-1.5.0_07.sh with the following: if [ -z "$JAVA_HOME" ]; then export JAVA_HOME=/usr/java/jre-1.5.0_07 export PATH="$PATH:$JAVA_HOME/bin" fi and made them executable. I removed the entries I had put in .etc/profile and logged out and back in. Now the PATH and JAVA_HOME environment variables look right. Perhaps I should have just deinstalled the jdk(jre)1.4.2 stuff -- I don't know. I haven't yet found anything that doesn't work right. Any good reason to keep the 1.4.2 release, or should I urpme it -- or will that cause me some yet unknown problems? Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted August 1, 2006 Report Share Posted August 1, 2006 I only have java 1.5 on my system, I removed the old 1.4 version when I manually installed the latest from java's website. Quote Link to comment Share on other sites More sharing options...
RVDowning Posted August 2, 2006 Author Report Share Posted August 2, 2006 BTW, I did the same. Just have the 1.5 now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.