Installing Sun Java JDK for Users

Issues related to software problems
Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Installing Sun Java JDK for Users

Post by Lenard » 2007/01/24 01:27:28

The lines are added to you hidden .bash_profile in your home directory by any text editor.

Example;

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:.

export JMFHOME=/usr/lib/JMF-2.1.1e
export CLASSPATH=.:$CLASSPATH:$JMFHOME/lib/jmf.jar
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JMFHOME/lib"

export PATH
unset USERNAME

PJKelley
Posts: 1
Joined: 2009/02/02 14:41:33

Re: Installing Sun Java JDK for Users java.sh

Post by PJKelley » 2009/02/02 15:00:36

Very helpful thread - but I noticed (and got bitten) by a subtle problem with /etc/profile.d/java.sh definition as originally posted...

Original:
export JAVA_HOME="/usr/java/jre1.5.0_09/bin"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"

However the JAVA_HOME should be simply /usr/java/jre1.5.0_09 and should *not* go as deep as the bin
Also - the use of quotations can wreak havoc in this case - this case sets the path to *literally* "$PATH:$JAVA_HOME". (ouch!)
So I removed the quotations, and the remaining two lines needed editing to set the correct path items.

My revised /etc/profile.d/java.sh - notice no ".../bin" in JAVA_HOME line 1, but on line 2 instead for JAVA_PATH. And lastly line three uses "$JAVA_PATH" instead of "$JAVA_HOME"
export JAVA_HOME=/usr/java/jdk1.6.0_11/jre
export JAVA_PATH=$JAVA_HOME/bin
export PATH=$PATH:$JAVA_PATH

Post Reply

Return to “CentOS 4 - Software Support”