1

I just web-started my Java application on Windows like this:

> jdk1.8.0_72\bin\javaws http://myserver/myapp.jnlp

Notice that I am using the javaws binary from jdk8u72. While my app was starting, I saw all sorts of evidence that my app was picking up most, but not all jars from here:

C:\Program Files\Java\jre1.8.0_77

I know this because my app prints the jars it is loading to the console. My app also prints the value of System properties java.version and javafx.version, so I know their values are:

java.version=1.8.0_77
javafx.version=8.0.72

That can't be good.

So, I retroactively inspected the value of environment variable JAVA_HOME and saw this:

> echo %JAVA_HOME%
C:\blah\blah\blah\jdk1.8.0_11

Holy crap! Neither 72 nor 77, but 11!

My JNLP file requests the Java and JavaFX resources in this manner:

<resources>
    <jfx:javafx-runtime version="8.0+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
</resources>
<resources>
    <j2se version="1.8+" .../>
    ...
</resources>

I wonder if anyone out there can explain the logic that Java Webstart uses to find the jars it will end up using, how this situation can be avoided.

I thought for sure that JAVA_HOME or that starting a particular javaws binary would do the trick, but apparently not.

Update: No, this is not a duplicate of Webstart runs with wrong version of JRE as I am not using the Browser, but invoking the javaws binary directly. Furthermore, I am not only getting the wrong JRE, but bits and pieces from two different JREs!

Update: Apparently, this has little or nothing to do with Webstart. I downloaded all the jars, configured CLASSPATH, and started my application in this way:

> java -jar myapp.jar

And I see the same behavior. So, I did this to see which java I am actually running:

> where java
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\blah\blah\blah\jdk1.8.0_11\bin\java.exe

If I spell out exactly which java.exe I want, everything is uniform. If I allow C:\ProgramData\Oracle\Java\javapath\java.exe to start my app (what is it this thing?!?) my JVM runs with bits and pieces from two different JREs.

Community
  • 1
  • 1
davidrmcharles
  • 1,923
  • 2
  • 20
  • 33
  • 1
    It typically uses a JRE at runtime; the JDK contains the compiler. The JRE contains all that is necessary to run Java class files; the JDK adds a compiler. – Elliott Frisch Apr 11 '16 at 22:46
  • 1
    Possible duplicate of [Webstart runs with wrong version of JRE](http://stackoverflow.com/questions/9802577/webstart-runs-with-wrong-version-of-jre) – Debosmit Ray Apr 11 '16 at 22:46

0 Answers0