0

I am working on a large JavaFX application which is due for deployment. I want to wrap the .jar files with Launch4j and create an installer using Inno Setup. However, I am having trouble with the process.

When using Launch4j, it spits out these errors (see 1). However, despite these errors, everything works perfectly fine using an MWE I created to verify that Launch4j wraps jar files properly. The MWE is just a small JavaFX application, where I use Launch4j to generate an .exe file and use Inno Setup to generate an installer. I can install this MWE with no issues using the generated installer and run the app. As mentioned, however, when I follow this exact same approach for my large application, which does have a lot more dependencies, I am not able to run the application after using the generated installer.

I searched for solutions to this and found this work-around using Inno Setup (see ban-geoengineering's answer):

How do I bundle a JRE into an EXE for a Java Application? Launch4j says "runtime is missing or corrupted."

I followed the steps mentioned but am still not able to run the application after generating the jar wrapper with Launch4j and running the generated installer created by Inno Setup. When I try to run the app, simply nothing happens.

Application information and development environment

The application utilizes custom-made java libraries developed in-house which act as an intermediary to communicate with a device's eSW through a custom interface. These java libraries and device drivers are needed in order to communicate with the device and need to be delivered with the application, as in included with the installer. I am using IntelliJ IDEA 2018.1 under Windows 10 Enterprise. The JDK is version 9.0.4.

Steps taken prior to using Launch4j and Inno Setup

I have followed the steps mentioned here https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html#package to package the application. I can successfully run the application via the commandline using java [options] -jar nameOfJar. The application needs certain VM options in order to communicate with the device drivers, and I am suspecting the issue lies here when generating the .exe file and generating the installer.

Addition 1

I have tried to add a custom classpath in Launch4j. It seems that Launch4j does identify the jars that the main class is dependent on, as it includes all the proper jar files (see 3).

I have in addition to this tried to mimic the JVM options I use to run the application via the commandline (see 4).

When executing the application it spits out NoClassDefFoundError and says it is due to the com/demant/gearbox/corona/model/GBCManager. However, this should already be included via the jar file com.demant.gearbox.corona.model.jar, as you can see in 3.

But, as you can see from both 3 and 4 the NoClassDefFoundError is still thrown.

kdhansen
  • 107
  • 9
  • If you have some code or error log, just paste it here along with your question instead of uploading images. – pptaszni Apr 10 '18 at 12:46
  • are you using maven ? if not are you sure that all jars all embedded with your final jar ? – Elarbi Mohamed Aymen Apr 10 '18 at 16:16
  • @ElarbiMohamedAymen I am not using Maven. I haven't merged my jar files. I have 1 jar file, which includes the main application, and 67 jar files which are dependencies. I have tried to use a custom classpath in Launch4j. I have updated my question with a new section, "Addition 1" to elaborate on this. – kdhansen Apr 10 '18 at 17:46
  • @Ptaq666 OK. Is this preferred? I use pictures because I feel it gives a clearer picture of what I am doing in Launch4j. – kdhansen Apr 10 '18 at 17:47
  • @kdhansen on my experience you need to wrapped your dependency with your jar if you have 67 jars as dependencies you need to merge them into one – Elarbi Mohamed Aymen Apr 10 '18 at 18:46
  • @kdhansen, yup, usually preferred because you can easily copy-paste text and you don't risk the image will be deleted from the external server (questions on SO are supposed to help people in the future as well). – pptaszni Apr 11 '18 at 12:02
  • @Ptaq666 Ok, I will keep that in mind. Thanks for the heads up. – kdhansen Apr 11 '18 at 19:40

0 Answers0