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:
.exe
file that does not require a JVM to be pre-installed.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.).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.).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.
Open Firefox and select 'Options'. 3. Under the 'General' category, scroll down to the 'Applications' section. Click the drop down menu for 'JNLP files' and select 'Use Java Web Start Launcher'.
The Java Network Launch Protocol (JNLP) enables an application to be launched on a client desktop by using resources that are hosted on a remote web server. Java Plug-in software and Java Web Start software are considered JNLP clients because they can launch remotely hosted applets and applications on a client desktop.
Right-click a JNLP file and click “Open With.” Select the “Java Web Start Launcher” application in the list or click “Browse,” browse to the “C:\Program Files (x86)\Java\jre[version]\bin” folder on your computer and double-click the “Javaws.exe” program file.
I have been able to do this & use it in production.
write a simple bootstrap class, jar it, and Launch4j the jar.
here's the main for the simple bootstrap class:
public static void main(String[] args) {
try {
final File jnlp = File.createTempFile("temp", ".jnlp");
final URL url = new URL("http://yourjnlp-wherever-youre-hostingit.jnlp");
yourCopyStreamMethodYouWrote(url.openStream(),new FileOutputStream(jnlp));
Desktop.getDesktop().open(jnlp);
} catch (final Throwable t) {
// do something useful here
}
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With