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, eg 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.
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.
You can also consider compiling your project with Excelsior JET. Apart from everything else it also creates a self-sufficient distribution of reasonable size.
Though not free for non-commercial use, Install4j offers a native installer system for Java applications. JRE bundling is supported. I am not sure it can parse JNLP automatically, but it may be something worth checking out.
As an sample use case, the Java-based Integrated Genome Browser gets distributed with an installer generated by this tool. See its install4j configuration file .
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.