Here's how I created a jar file using maven.
Now for my JavaFX Application, I'm using afterburner FX Framework. Now I need to create an installer for this app to be deployed to other devices. I'm using Install4j. My steps:
mvn clean package
- copy and paste the generated jar file into a different directory
- add that directory to install4j Files
- on Launcher under Java invocation, I select the jar file, and then I select my main class: `BOOT-INF.classes.inc.pabacus.TaskMetrics.TaskMetricsApplication`
- I Build the installer and run it, install to Program files, and then open the exe file
But then an error dialog shows up:
java.lang.NoClassDefFoundError: BOOT-INF/classes/inc/pabacus/TaskMetrics/TaskMetricsApplication (wrong name: inc/pabacus/TaskMetrics/TaskMetricsApplication)
So what I did wrong was two things:
Initially, like way way back, I tried using JavaFX with Spring Framework - unsuccessfully. I'm no longer using Spring, but I still had some leftover Spring in my pom file, which caused it to put the files in a
BOOT-INF
directory when i package it to jar. I just simply had to remove the Spring leftovers, and the boot-inf directory was gone.So in install4j, you select a directory that would contain the files you would add to your installer. In the tutorials, they had a separate
lib
directory which contained external libraries. So I thought that's all I needed. I copied my dependencies into a lib folder via maven, then i put them into a directory along with my jar. So that's all my directory had - the jar file and the lib folder. That doesn't work. I didn't know. Apparently, it needs all the files inside the target folder generated by maven. I should've just used the target folder itself.
So there you have it. I have now successfully created an installer. I do hope no one walks as silly as me, but if you had also encountered the same mess up, well... here ya go.