Combination of Launch4J and Java Web Start?

只谈情不闲聊 提交于 2019-11-30 09:44:45

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.

niceguy

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
  }
}

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

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!