Jar to exe with an external library

China☆狼群 提交于 2019-12-01 09:56:26
Andrew Thompson

It's time for me to deploy it, hence I need to convert it to exe.

Those two statements do not make sense together. We cannot deploy a Swing desktop app. to *nix or OS X using a Windows based executable. The best option for deploying a Java desktop app. is typically from a link on a web page using Java Web Start.

From BlueCove Documentation: Installation:

Installation

BlueCove rely upon already installed native Bluetooth stack that comes with you operating system or Bluetooth USB device.

Installation of the binary (already compiled) version of BlueCove is as follows:

  • Download BlueCove binary release
  • Add bluecove.jar to your classpath
  • Also add bluecove-gpl.jar to your classpath if you are running application on Linux

This would imply something like the following. 2 Java Web Start based JNLP extensions:

  1. An extension for the BlueCove main API (bluecove.jar) to support Windows and OS X, as well as the core classes needed for Linux. This 'main' JNLP file would have a resources section specific to Linux, which in turn references the 'Linux only' extension JNLP.
  2. An extension for the Linux specific API (bluecove-gpl.jar) which includes an installer element to pop a license prompt for the user (if needed, this entire extension is necessary only for producing a license prompt). Here is a small demo. of the ExtensionInstallerService that would show a license agreement.

..would this require the user to always have an internet connection when using the application, or is it just the first time activation that requires internet?

The Java Web Start client (the app. that launches an appropriate JVM and your app.) would typically check back with the home server for updates to the application Jars relevant to that OS. Fortunately it is configurable as to when and how the check is done, and whether the application can be run 'off-line' as you require, by specifying an element in the JNLP:

<offline-allowed />

The offline-allowed element (part of the jnlp element) ensures that after initial installation, the app. can be used off-line.

Make sure you added bluecove JAR into classpath when creating launcher: setting classpath in JSmooth, setting classpath in Launch4j.

Inside the jar you need to put all dependant jars or you can have manifest for your jar use the Class-Path header.

You can also try fat-jar extension or One Jar

To resolve this issue you put all dependent jars inside your final jar file.
In eclipse, you can do this in following way: File -> Export -> Java -> Runnable Jar File -> (Select the option) Package required libraries into generated jar
Now use this jar to create an exe using any jar to exe converter of your choice!
hope this helps

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