LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-07-2006, 05:50 PM   #1
philosophia
Member
 
Registered: Jun 2006
Posts: 54

Rep: Reputation: 15
JDK1.5 install RHEL4


My server already had Java 1.4.2 installed. I'm trying to upgrade to Java 1.5.
I've tried installing via the jdk-1_5_0_07-linux-i586.rpm file and the jdk-1_5_0_07-linux-i586-rpm.bin file downloaded off java.sun.com.

I used the sun install instructions off the sun site - I can't post a link to it since I don't have enough posts - for reference.

I know the installation was successful. When I do
#rpm -qa | grep jdk
jdk-1.5.0_07-fcs

However, when I do
# java -version
I get

java version "1.4.2_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
BEA WebLogic JRockit(TM) 1.4.2_08 JVM R24.5.0-61 (build ari-49095-20050826-1856-linux-ia32, Native Threads, GC strategy: parallel)

I've tried rebooting, I've tried editing /etc/profile to point JAVA_HOME to the jdk1.5.0_07 directory. Working java version still shows up as 1.4.2.

I've been told to try 'update-alternatives --config java' to switch java versions. When I do this, it only lists 1.4.2 as an alternative.

How do I get the system to use the newly installed jdk1.5?
 
Old 06-07-2006, 08:06 PM   #2
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
Wrote this a while ago, ajust to match the newer version and for jdk;

Reconfiguring CentOS 4's default Java configuration

This is done as root or equivalent.

First remove /var/lib/alternatives/java file by typing;

rm /var/lib/alternatives/java

When asked press the 'y' key,

Now to create the new (corrected) alternatives file for java type
the following commands as root (modify for jdk as needed);

/usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.4.2-gcj/bin/java 1

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/j2re1.5.0_06/bin/java 2

/usr/sbin/alternatives --config java

You should now see for example:

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/java/j2re1.5.0_06/bin/java

Enter to keep the current selection[+], or type selection number:

Type: <choose 1 or 2>

In the example above java is already configured correctly [*+ 2] to
use Sun's Java, no changes are needed, just press the Enter key here.
If you have been following the instructions then you should have
the same results (version numbers may be sightly different).

Now type; /usr/sbin/alternatives --display java

You should see for example;

java - status is manual.
link currently points to /usr/java/j2re1.5.0_06/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1
/usr/java/j2re1.5.0_06/bin/java - priority 2
Current `best' version is /usr/java/j2re1.5.0_06/bin/java.

Next you might want to create (or edit) /etc/profile.d/java.sh
file, example below;

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

When done creating or editing the file type;

source /etc/profile.d/java.sh

Now any user root or other wise should be able to use the command;

which java

and the results should read something like;

/usr/java/jre1.5.0_06/bin/java

Also any user root or other wize should be able to use the command;

java -version

and the results should read something like;

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)


That's it, all done.
 
Old 06-08-2006, 10:57 AM   #3
philosophia
Member
 
Registered: Jun 2006
Posts: 54

Original Poster
Rep: Reputation: 15
thanks! this worked like a charm.

/me smashing his head against redhat
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
install compat-libstdc++ on RHEL4 thuang Linux - Newbie 2 03-17-2008 12:24 AM
installation issue: unable to install Rhel4 jagannathan.r Linux - Newbie 2 02-18-2006 05:38 PM
can't install jdk1.5(and some other software) DrowningFish Linux - Software 3 02-11-2006 02:41 PM
How do I install 'unrar' in RHEL4/CentOS4.1 aratis Red Hat 3 07-20-2005 02:14 AM
Install RHEL4 in VMware Workstation5.0 gerrylin Linux - Enterprise 1 05-08-2005 11:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:54 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration