Running JDK 1.7 classes

The public knowledge pool and discussion forum of the OWS community. Do not post confidential information here!
javaapp
Posts: 15
Joined: 20 May 2020, 18:34

Running JDK 1.7 classes

Post by javaapp »

I realize that OpenWebStart is intended to support JDK8+ runtimes, but as part of my evaluation of OWS I was required to try using it run an app that was compiled using JDK 1.7.

If I use j2se="1.8*" in the jnlp, OWS runs the app just fine.
If I use j2se="11.0.2" in the jnlp, OWS seems to run the app but hangs. The app does not appear nor is there any obviously informative messages in the log files.

Is this the expected behavior, when using JDK 11 to run JDK 1.7-compiled classes in OWS?

Thanks!

Stephan Classen
Posts: 25
Joined: 27 Mar 2020, 09:55

Re: Running JDK 1.7 classes

Post by Stephan Classen »

OWS does no magic. It is only a launcher for your application.
In general a newer JVM can run code compiled for an older Java version.
But be aware that Java may has changed behavior between 1.7 and 11.
Deprecated methods have been removed and some more subtle changes may also be there.
Very famous was for example the change from 1.5 to 1.6 where HashMap iterated over its content differently and crashed a good hand full of programs relying on the way java 1.5 was doing it...

So maybe try to run your application without OWS/JNLP as a simple Java application on a JVM 11 and see if you observe the same behavior.

Stephan Classen
Posts: 25
Joined: 27 Mar 2020, 09:55

Re: Running JDK 1.7 classes

Post by Stephan Classen »

As a hint: in the log files of the first stage you will see a line shortly before the end which starts with: "About to launch external with commands"
In this line you see all the arguments that OWS is passing to the JVM when launching your application

javaapp
Posts: 15
Joined: 20 May 2020, 18:34

Re: Running JDK 1.7 classes

Post by javaapp »

Awesome feedback and suggestions, thanks! I apologize for wasting your time: the JDK7-compiled app is running fine under JDK11 now. Not sure why it was fidgety before but i had been playing with various options so...

Your tip about looking for that log message was helpful - I massaged that output into a command-line and was able to successfully run the app that way AND then successfully using a jnlp file.

Post Reply