views:

122

answers:

4

I have a working JNLP application which I need to distribute to various non-technical end users.

If the user's machine has a recent JVM installed, everything is fine. They just double-click the JNLP file I send them and Java Web Start does the rest.

Now I would like to distribute something that works with or without a JVM, e.g. a .exe file that auto-downloads a compatible JVM if none is present, then invokes javaws.exe to download the .jar files and launch the application.

Launch4J is the closest match I have found, but it cannot launch a program through javaws.exe. The only options are java and javaw

I would like a product that can:

  • Generate a self-contained .exe file that does not require a JVM to be pre-installed
  • Parse the .jnlp file and determine the correct JVM to download if necessary (I know Java Web Start can download a JVM if necessary, but I want to avoid having to download two, the first to bootstrap Java Web Start and the second to run the application which may require a specific but different JVM.)
  • Download and install the JVM automatically, not simply direct the user to a Java download page or open a new installation wizard.
  • Prompt for an admin password if necessary (for permissions to install the JVM. I don't think this is built into the Sun JVM installers.)
  • Show only one security dialog (I would like to prompt the user just once, to confirm they trust the generated .exe, but I do not want a second prompt to confirm they trust the .jar file which will be from the same source and signed with the same certificate.) I assume this will require the auto-downloader to install the certificate before launching JWS.)
  • (not essential) Download application resources (e.g. .jar files) in the background simultaneously with the JVM. This would require the cache to be running before the JVM is installed, so the cache would have to be implemented in native code and the DownloadService would later interface to it using JNI.

Does a product like this exist? I suspect it does not but It's worth a shot.


Update I found this article which has solutions to some related problems, though it is designed for offline installation and I am mostly concerned with online installation.

A: 

Another approach might be also distributing a Sun JRE with a .BAT-file invoking it with the /S switch, which cause a silent install.

I have not seen anything else allowing for a completely silent Java install combined with invoking javaws.

Thorbjørn Ravn Andersen
A: 

Ok i get what you are trying to do but why don't you want use javaws? Launch4J looks like a good option as alternate to having java installed, as it will allow seamless usage of the jar file.

javaws is more or less uses java.exe with security permissions and some launch options. But the security permissions can be disabled if you use a certificate that the user trusts.

Also i am unsure when javaws was introduced but i am sure it was available in java 1.5 which i near EOL. So unless your user has not had a java installed for many years i doubt getting them to launch jnlp would be a problem. Even if they are running an older version you can add a required version of java to the jnlp and this will be automatically downloaded for that application only.

kohlerfc
I *do* want to use javaws. The problematic case is a PC that has never had Java installed.
finnw
+1  A: 

I've run into the same problem. I ended up with a BAT, a Shell and eventual a DMG for Macs.

I found this comment on automaded JRE installation for Windows using Nullsoft installer:

http://nsis.sourceforge.net/Java_Launcher_with_automatic_JRE_installation

I think outside JNLP you will find hard to get automation for all platforms. However on my project, up for two year, I haven't seen complains about users having to get java by themselves. I believe most machines will have it already. Windows user complained about not having a shortcut, but that is easy to do using vbs.

Also on the Mac DMG AppBundle, their is way to specify the JRE. Mac will have the lastest version, unless the are older PowerPC based machines. In that case no Java6.

Of you end up with several launcher, I would recommend an automated update strategy.

Thomas
I am not so worried about non-windows platforms. Macs always have a JVM installed, and I assume most linux users have the technical knowledge to find and double-click the `.jar` file if necessary.
finnw
+1  A: 

You can also consider compiling your project with Excelsior JET. Apart from everything else it also creates a self-sufficient distribution of reasonable size.

ddimitrov