System Administration
Showing results for 
Search instead for 
Do you mean 

Which Java is being used.

Frequent Advisor

Which Java is being used.

Hello Alll,


We have Red hat Linux servers running SAP application. We have IBM and SUN java installed in it. Going further we will be installing SAP java. I am not sure which java is being used of the IBM and SUN.


How can i find which Java is being used i.e. IBM or SUN? Any specific command i can use?





Lead Engineer, IMS.
Honored Contributor Honored Contributor

Re: Which Java is being used.

First, you will need to determine the command and/or environment settings used when starting the Java application.


If the application is started with a script, you will need to check the script: there might be lines that set JAVA_HOME and/or PATH environment variables to point to a particular version of Java.


If the Java version is not determined explicitly at the application start-up script, you will need to look at the environment of the user that normally runs the application. The login scripts for that user might include JAVA_HOME and/or PATH settings that determine which version of Java will be used by default by that user.


If there are no application-specific nor user-specific settings, then you might use "which java" to see the pathname of the default Java interpreter (if there is a default Java interpreter).


Also, "java -version" might be useful to identify the manufacturer of a particular instance of Java.


If you see a "java" process in the process listing and want to know which version of Java it uses, make note of the PID of the process, then run "ls -l /proc/<PID>/exe". That will tell you the exact pathname of the java binary it uses.


Through the proc filesystem you can also take a peek at the environment variables of any running process, with a command like "strings /proc/<PID>/environ | less".