Jar file doesn't manifest main file

I wanted to run GraphHopper (locally) from python and so wanted to create a jar file in intellijidea. I created the jar file from project-structure->artifacts->create with dependency. and then built it from build->artifacts.

creating jar file from example module

However, when I try to run jar file from command prompt with ‘java -jar graphhopper-example.jar’ it does not work (with full path of the jar file). Error is

Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

I checked the ‘Manifest.mf’ in Meta-inf folder and it has the correct location of the main file. This is the location of files

Could you please suggest me how to solve this?

Thank you

Better use Maven to build the jar: mvn clean package -DskipTests=true

I added the main class in pom.xml (hope it is the right way to add) and ran again with mvn clean. Is there something I am missing?

You don’t need to modify the pom.xml file. After you added the main class and built the jar with Maven you just add the jar to the class path and execute the main class. In IntelliJ you can also simply click the play icon next to the main function.