Jar file doesn't run when I clicked on it

Answered

Hello guys.

I created a jar file for my project using these two methods: 1) command .\gradlew desktop:dist, and 2) using the build artifacts menu in intelliJ. Both files don't run when I clicked on them, they do run on my IDE though. I unzipped my 1st jar file, and the manifest.mf looks like this:

Manifest-Version: 1.0

Main-Class: com.mygdx.game.DesktopLauncher

 

 

0
2 comments

What is the error if you run the jar from the command line using java -jar jarname.jar?

Make sure the jar contains all the required dependencies: https://stackoverflow.com/a/42200519/104891 .

Also check there are no files with signatures: https://stackoverflow.com/a/45169655/104891 .

GDX framework jars may not work as they are likely missing the native dependencies required for the game engine to work.

Another possible reason is that your command line (default PATH) java version is older than the one used to build the project.

 

1

I fixed it !   n_n

You know what was causing the issue, it was String.repeat(), I got that error in the consoles output, I reinvented the wheel, and made my own repeat method for strings, then I created again the jar for libgdx using the command ./gradlew desktop:dist in intelliJ terminal, and it's working just fine. Thank you for taking your time for answering my post.

0

Please sign in to leave a comment.