Answer the question
In order to leave comments, you need to log in
How to create a working JAR file in Intellij IDEA?
Please help me create a working JAR file for my project made with the libgdx framework. I tried to do it through Project Structure -> Artifacts -> Create JAR from Modules, a JAR file was created that starts the application for 1 second with a black screen and then closes without error.
UPD1: I created a JAR file using Gradle, but it still does not launch the game, but an error was found. The problem was that all project images fail to load due to "wrong path". They are stored in the assets folder and therefore I load them via Gdx.files.internal("img_name.png"). Is it possible that the compiled JAR file is looking for files in the wrong path?
Answer the question
In order to leave comments, you need to log in
Maven
pom.xml
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>MainApp</mainClass>
<vendor>Company</vendor>
<jfxAppOutputDir>target/jfx</jfxAppOutputDir>
<verbose>true</verbose>
<appName>App</appName>
</configuration>
</plugin>
I had a similar problem but on Maven.
the code was compiled into 2 jar files, one jar included dependent libraries, the other did not.
and I ran a jar that didn't pack the libraries... what a pain it was!)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question