Jump to content

Problem setting JAVA_HOME when installing jdk1.5


Recommended Posts

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.....

Link to comment
Share on other sites

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

Link to comment
Share on other sites

/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 by RVDowning
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...