0

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?

mjn
  • 36,362
  • 28
  • 176
  • 378
  • 2
    Have you tried restarting glassfish? Could be that the server hasn't been restarted after upgrading the JRE (and therefore the old version could still be running in memory). – fateddy Feb 15 '15 at 10:56
  • @fateddy you are right - if you like you can add this as an answer too – mjn Feb 15 '15 at 12:45
  • Thanks - added as an answer. – fateddy Feb 15 '15 at 22:20

1 Answers1

0

Have you tried restarting GlassFish? Could be that the server hasn't been restarted after upgrading the JRE (and therefore the old version could still be running in memory).

fateddy
  • 6,887
  • 3
  • 22
  • 26