Reputation: 9653
I have a simple Swing app compiled with netbeans 7.1.2 on a ubuntu machine which has the java version:
java version "1.6.0_22" OpenJDK Runtime Environment (IcedTea6 1.10.4) (6b22-1.10.4-0ubuntu1~11.04.1) OpenJDK Server VM (build 20.0-b11, mixed mode)
jar works great when i use the shell using "java -jar filename.jar" in linux but in the windows 7 with the java version 1.7.05 i get: "Error: could not find or load main class"
How do i resolve this issue?
Upvotes: 0
Views: 5310
Reputation: 10920
This error usually shows up when you don't include the current directory (.
) in the classpath.
If there are any external libraries that you specify when starting the program, then you probably do something like java -jar -classpath dir/library.jar program.jar
. Instead, add .
to the classpath: java -jar -classpath .;dir/library.jar program.jar
Other possibilities are:
Upvotes: 4