Operating system: Ubuntu 12.04, GlassFish version: 4.0.1 (build 10)
In a GlassFish servlet I print the Java version in processRequest with this code:
out.println("<p>" + System.getProperty("java.version") + "</p>");
out.println("<p>" + System.getProperty("java.home") + "</p>");
out.println("<p>" + System.getProperty("java.vendor") + "</p>");
When I enter the servlet address in a web browser the output is
1.7.0_65
/usr/lib/jvm/java-7-openjdk-amd64/jre
Oracle Corporation
However if I enter java -version on the console, the output is
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~precise1)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)
I checked for installed Java versions and the system has only one Java version installed
~# update-alternatives --config java
There is only one alternative in link group java: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
Nothing to configure.
As expected, /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -version also displays java version "1.7.0_75"
So the installed Java version is 1.7.0_75 while GlassFish displays 1.7.0_65. Why?