LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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, 10: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, 10: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, 10:18 AM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,411
Blog Entries: 1

Rep: Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115
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, 10:22 AM   #4
PrinceCruise
Member
 
Registered: Aug 2009
Location: /Universe/Earth/India/Pune
Distribution: Slackware64 14.1/Current, CentOS 6.5/7.0
Posts: 795

Rep: Reputation: Disabled
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, 10: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, 10:28 AM   #6
PrinceCruise
Member
 
Registered: Aug 2009
Location: /Universe/Earth/India/Pune
Distribution: Slackware64 14.1/Current, CentOS 6.5/7.0
Posts: 795

Rep: Reputation: Disabled
cool.
 
Old 03-08-2011, 10: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, 11:04 AM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,411
Blog Entries: 1

Rep: Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115
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, 01:05 PM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,276

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:43 PM
Iceweasel Java plugin using the Apt version of Sun Java? Zaskar Debian 3 10-03-2008 08:35 AM
java -version, bash: java: command not found kirman Programming 4 03-20-2008 12:13 AM
Which version of JAVA to use? General Suse/Novell 1 06-14-2007 10: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 09:17 PM


All times are GMT -5. The time now is 08:00 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration