I have a big javafx application, but when I create a jar file, it won't run. It's a pity, because the project took 3 months
I already tried this instruction:
- Project Settings, Artifacts tab. Press [+], select JAR in the drop-down menu.
- In the left panel – the contents of the JAR file, in the right panel – the contents of the project. Drag and drop everything we want to include in the JAR from right to left.
- Specify the name for the file and the destination directory above the panels
- Click on the create manifest button under the left panel, create a manifest.mf. This will ask the IDE for the Main class and classpath to specify in the manifest.
- Don't forget to check the box "Build on make" above the panels
- There is now an artifact build command in the Build menu
But after doing all that, the jar file still wouldn't run. Everything works fine in the development environment. What could be the problem?
There can be many reasons. For example, the problem may be with the
Manifest file, with the location
fxml (I had IDEA suggesting that the root folder be specified with
../ , which is not the correct path definition), with the addition of third-party libraries, etc.
In order to catch it, you need to run it through a
jar file. You can run the
jar file in your own development environment. All errors will be displayed in the console there. Also, you can run it from the terminal. In the folder with the file you need to register:
java -jar [имя_файла].jar