Question

When I'm making a new JNLP file, I have to enter the versions of JAVA that my applet can work with, for example

     <j2se version="1.6+">

Obviously, I want my applet to work with as many versions as it can, (I do, right?) how can I know what is the minimum required version to run my applet?

Was it helpful?

Solution

obviously, I want my applet to work with as many versions as it can, (I do, right?)

I disagree. It is well known that running Java in the web browser is a security nightmare. The best approach (for your users' security!) is to not use applets at all. But if you must do it, then you should be aiming to do it as securely as possible. That means writing your JNLP file to insist on a recent version of Java. Preferably, the most recent patch level of Java 7.


But to answer your Question, the simplest test to find the oldest a version of Java should support your application is to attempt to compile it with that version of the JDK. If it compiles on an old version JDK, then it is fairly likely that it will run.

But then you should test it, because successful compilation does not guarantee that the application will run properly.

And as @Lonzak points out, there is a separate issue of whether the user's installed Java supports JNLP.

OTHER TIPS

There ought to be a better way but the following are the most general ones in my opinion:

  • Set the version of the Java Applet in your IDE to the lowest version you want to support and start programming.
  • Check the libraries/functions you need and check in which version they have been added.

When you want to use the JNLP mechanism you are bound to the next generation java plugin. It is supported starting with Java 1.6.0_10 (6u10). Java version older than that does not support JNLP. So if you want to support older Java versions you have to use the "old" mechanism (e.g. applet, object and embed tags).

So what would could you do?

Write a preceding applet, which is compiled with Java 1.4 (or even earlier). This applets basically only checks the Java version and other prerequisites. If the Java version is not sufficient (<6u10) it displays an error and otherwise the JNLP based applet is started...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top