LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-08-2011, 09:05 AM   #1
ajslinux
LQ Newbie
 
Registered: Mar 2011
Posts: 5

Rep: Reputation: 0
Redhat 5.5 and java -version


Hi All,

I am working on a new Redhat Server (RHEL 5.5). It has java version "1.4.2" installed on it. I have installed
jre1.6.0_24 on it but "java -version" is still showing the old java version (1.4.2). How can point "java -version" to the new install?

Thanks for your help!
Ajay
 
Old 03-08-2011, 09:17 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by ajslinux View Post
Hi All,

I am working on a new Redhat Server (RHEL 5.5). It has java version "1.4.2" installed on it. I have installed
jre1.6.0_24 on it but "java -version" is still showing the old java version (1.4.2). How can point "java -version" to the new install?

Thanks for your help!
Ajay
where is your java path??

Code:
which java

you can either create a symlink from your new jreinstall path executable to your standard java path (/usr/bin/java, but you would have to rename /usr/bin/java first) OR add the path for the new jre to /etc/profile or your .bash_profile etc or just switch the paths from the old java to the new jre install.
 
Old 03-08-2011, 09:18 AM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
The important question here is - "Is anything going to break, if i tell you how, because some program will need that old java version?"
 
Old 03-08-2011, 09:22 AM   #4
PrinceCruise
Member
 
Registered: Aug 2009
Location: /Universe/Earth/India/Pune
Distribution: Slackware64 -Current
Posts: 890

Rep: Reputation: 186Reputation: 186
Hi,

When you run java -version, the system searches for the PATH for the installed java.
So update the path, IMO it should work :

#export PATH=/new/path of java/wherever/it/is:$PATH

Now try # java -version.
 
Old 03-08-2011, 09:26 AM   #5
ajslinux
LQ Newbie
 
Registered: Mar 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for your responses. I was able to do this, here is the solution:

# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-48)
# which java
/usr/bin/java
# ls -ld /usr/bin/java
lrwxrwxrwx 1 root root 22 Jan 11 04:55 /usr/bin/java -> /etc/alternatives/java
# rm /usr/bin/java
rm: remove symbolic link `/usr/bin/java'? y
# ln -s /usr/java/jre1.6.0_24/bin/java /usr/bin/java
# ls -ld /usr/bin/java
lrwxrwxrwx 1 root root 30 Mar 8 10:20 /usr/bin/java -> /usr/java/jre1.6.0_24/bin/java
# java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
 
Old 03-08-2011, 09:28 AM   #6
PrinceCruise
Member
 
Registered: Aug 2009
Location: /Universe/Earth/India/Pune
Distribution: Slackware64 -Current
Posts: 890

Rep: Reputation: 186Reputation: 186
cool.
 
Old 03-08-2011, 09:58 AM   #7
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
yayyy
 
Old 03-08-2011, 10:04 AM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Keep in mind that a LOT of java programs like you to:

export JAVA_HOME=/wherever/java/bin/

In your shell environment
 
Old 03-08-2011, 12:05 PM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
The standard set up for EL5 is :

1)
# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0_24/bin/java 2

2) # /usr/sbin/alternatives --config java

.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Default socket name and version in Redhat linux with kernal version 2.4-20-8??? sivareddy_jntu Linux - Networking 1 06-12-2009 02:43 PM
Iceweasel Java plugin using the Apt version of Sun Java? Zaskar Debian 3 10-03-2008 07:35 AM
java -version, bash: java: command not found kirman Programming 4 03-19-2008 11:13 PM
Which version of JAVA to use? General SUSE / openSUSE 1 06-14-2007 09:51 PM
redhat fedora gcc version (compiled for 2.4.20) doesn't match kernel version 2.4.22 start1000 Linux - Software 0 03-16-2004 08:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:50 AM.

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