[RHEL 5] A question about multiple Java
Hi,
As I run 'java -version', I got Code:
# java -version But as I run 'yum list installed |grep java', I got: Code:
# yum list installed |grep java As I run 'sudo update-alternatives --config java', I got Code:
]# sudo update-alternatives --config java As I run '/usr/lib/jvm/jre-1.7.0-oracle.x86_64/bin/java -version', I got: Code:
# /usr/lib/jvm/jre-1.7.0-oracle.x86_64/bin/java -version How can I remove the 1.7.0_45? |
Type "which java" to find out the path of the java binary on which you originally ran the version command.
By default on RHEL that would normally be /usr/bin/java which is a symbolic link created by alternatives to whichever package is installed. Run "ls -l <pathto>/java" on whichever java binary and path is returned by the "which" command. It it were doing the default RHEL setup that should return something like: lrwxrwxrwx 1 root root 22 Apr 6 2009 /usr/bin/java -> /etc/alternatives/java That shows /usr/bin/java is a symbolic link and that the file it is linked to is /etc/alternatives/java Note that /etc/alternatives/java is usually itself another symbolic link so doing ls -l on the one shown in example confirms that lrwxrwxrwx 1 root root 39 Aug 8 2010 /etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0-openjdk/bin/java However in your setup I suspect that: EITHER "which" is NOT pointing to /usr/bin/java This would be because your $PATH variable is finding a "java" somewhere setup by your environment profile, .bashrc or other setup file in a directory specified in $PATH before /usr/bin (e.g. /bin, /usr/local/bin, .) or because there is no java in /usr/bin so it is finding one after the /usr/bin in $PATH. OR /usr/bin/java is NOT linked to /etc/alternatives but rather to some other installation of Java. It is possible to install Java by downloading the bundle (or even just the binary) from somewhere else and putting it on your system. If /usr/bin/java is NOT a link then it was likely hard copied binary to that location by someone. If it is a link you need to go down the tree of links to determine where the real binary is. Once you find that you can type "rpm -qf <pathto>/java" to see what RPM installed it. If no RPM installed it then it may have been installed directly by copy from another system or by download of the bundle from someplace such as the Oracle Java site. Note: Rather than removing the first Java you found (with the "which" above) you might want to make a copy of it then overwrite the original with a link to the correct location. Some applications will fail with minor variations in Java version and you'd want to be able to back out quickly if you saw this as an issue. |
All times are GMT -5. The time now is 11:51 AM. |