I have a rather big javafx application, but when I create a jar file, it does not start. It is a pity, because the project has spent 3 months

I have already tried this instruction:

  1. Project Settings, Artifacts tab. Click [+], in the drop-down menu, select JAR.
  2. In the panel on the left, the contents of the JAR file, in the panel on the right, the contents of the project. Drag from right to left all that we want to include in the JAR.
  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 manifest.mf. In doing so, the IDE will ask the Main class and the classpath to be specified in the manifest.
  5. Do not forget to put a tick "Build on make" above the panels
  6. Now in the Build menu there is an artifact build command

But after all this, the jar file still did not start. In the development environment, everything works fine. What could be the problem?

  • one
    Tried to run through the terminal? If so, what error did it give? - Riĥard Brugekĥaim
  • Try using project collectors (ant, maven). It will take a little time to learn, but it will be useful in the future - Andrew Bystrov
  • Can you throw off a video or an article about this (ant, maven)? - dhred
  • Try to open the jar-file, and find the manifest there, when generating the jar, the Main-Class may disappear there. If not, then add and update the archive - Mikhail Ketov

1 answer 1

The reasons may be many. For example, the problem may be with the Manifest file, indicating the location of fxml (I have IDEA suggested specifying the root folder with ../ , which is not the correct path definition), adding third-party libraries, etc.

In order to catch you need to run through the jar file. You can run the jar file in the development environment. All errors will be displayed in the console. Also, you can run from the terminal. In the folder with the file you need to register:

java -jar [имя_файла].jar