LMC Corner -- Ensuring You Are Using The Right Java Build
Bill Malchisky October 5 2012 02:00:00 AM
To determine if IBM Java is installed on our machine, type:#rpm -qa |grep IBM
Then, find the subdirectory for the java executable $ls /opt/
You'll see IBMJava2.... (the rest is version specific e.g.: IBMJava2-1.4.2)
$ls /opt/IBM [tab][tab]
Record this path for use below.
Notations
A. You are probably wondering why I prefaced the "ls /opt" command with the RPM sequence? Simply put, just because a product exists on one's server, does not necessarily indicate that it is installed and therefore recognized properly by the system.
B. The [tab][tab] sequence denotes file completion assistance to save you time, the characters on the command line do not change with this feature
C. Although it is installed by default, you do not have the IBM JVM installed, then you need to install it first to have the LMC software work properly; see the installation files for the package
Yes, upon installing the IBM JRE, you need to do a verification test to ensure that everything is working properly.
1. #java -version
If you see
"gij (GNU libgcj) ..."
"gcj ... "
these are the default installed Java versions with Red Hat. Thus, they are (a) potentially older; (b) not the installed IBM version that the LMC is compiled against during the build.
2. If you see
Java(TM) 2 Runtime Environment, Standard Edition (Build 1.4.2)
Classic VM (build 2.4.2), J2RE 1.4.2 IBM build cxia...
Then you have the correct working Java version for the LMC.
To fix issues with (1) above, there are two ways to resolve the matter
1. Redirecting the executable
#which java
/usr/bin/java
Verify where the Java executable is pointing:
#ls -l /usr/bin/java
/usr/bin/java -> /etc/alternatives/java
If it is not pointing to IBM (it won't be if you are here, unless you have a heavily customized Red Hat box);
#rm /usr/bin/java (or mv if you prefer)
Syntax: #ln -s
Example: #ln -s /opt/IBMJava2-142/jre/bin/java /usr/bin/java
#ls -l /usr/bin/java
Verify that you see: /usr/bin/java -> /opt/IBMJava2-142/jre/bin/java
#which java
#java -version
If you see IBM listed now, you are all set
2. Altering the path - a bit more complex, so unless you are comfortable editing a text file, just do the first one
$ls /opt/IBMJava2-142/jre/bin/java
(see if it exists; change for the version if it is no 1.4.2
#vi /etc/profile
/PATH
proceed till you find the last entry and append the path to the IBM Java path (from the the "To determine if IBM Java is installed..." section
Save your file and run the #java -version command again to ensure success.
Note: solution one is the preferred approach and should be used, unless you have a need to run multiple JVMs in production, which is why the alternate solution is provided; though one should be mindful of the scope issue with the path, as the first match that the IBM Java request finds is the one that will execute.
- Comments [0]