CosminO
CosminO

Reputation: 5226

Runnable jar doesn't work from one machine to another

So when exporting the project as a runnable jar, the jar works fine on the current machine. Moving the jar to another machine, and it cannot find the main class: Used cmd to get the error:

        Desktop>java -jar RunMe.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:56)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 500
        at pnl_user.readFile(pnl_user.java:667)
        at pnl_user.readTNS(pnl_user.java:432)
        at pnl_user.<init>(pnl_user.java:412)
        at main.<clinit>(main.java:9)
        ... 3 more

Upvotes: 1

Views: 236

Answers (2)

Roy Ling
Roy Ling

Reputation: 1632

Is this runme the jar name or main class in the jar?

To launch your app from a jar, you can do the below:

java -jar runme.jar

Upvotes: 2

Joachim Sauer
Joachim Sauer

Reputation: 308051

To run a JAR file use java -jar thejarfile.jar.

java runme would try to run the class runme from the current classpath (which is probably not set up to point to your application).

Upvotes: 3

Related Questions