java – how to create jar file in idea?


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:

  1. Project Settings, Artifacts tab. Press [+], select JAR in the drop-down menu.
  2. 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.
  3. Specify the name for the file and the destination directory above the panels
  4. Click on the create manifest button under the left panel, create a This will ask the IDE for the Main class and classpath to specify in the manifest.
  5. Don't forget to check the box "Build on make" above the panels
  6. 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

Scroll to Top