Reputation: 1243
I'm making a program in java which is just a basic J based gui program. when i compile it in eclipse using the play button, it runs perfectly and there are no bugs or errors to be seen.
But when i export it and run it, it just returns an error saying the main class cannot be found, there shouldn't be a problem because i have the launch configurations set up correctly and for some reason this only happens when im programming in java 1.7, when i do it in 1.6 it compiles and runs perfectly. even when i export it.
How I export
I just run it by opening to jar file
Inside my MANIFEST.MF file:
Manifest-Version: 1.0
Rsrc-Class-Path: ./
Class-Path: .
Rsrc-Main-Class: net.undeadminecraft.wgh.main.Main
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
The error message i get
My packages (if it helps)
Upvotes: 3
Views: 3811
Reputation: 532
I would suggest to set your main class as the "Main-Class" in the MANIFEST.MF:
Manifest-Version: 1.0
Rsrc-Class-Path: ./
Class-Path: .
Main-Class: net.undeadminecraft.wgh.main.Main
Could solve your problem, as the main class you had in there is an internal class by Eclipse.
Upvotes: 1
Reputation: 6735
Run your JAR on the console (java -jar yourjar.jar
) and post the full stack trace. Also post output of java -version
and javac -J-version
.
My guess is that your default Java is Java6, and if you build with Java7, you are using the new Java7 class file format, or your main class contains a reference to a class not present in Java6 (in a place where verification cannot be deferred).
EDIT: Use Process Explorer or another task manager that shows exe paths and that can find process for a window, and show which javaw.exe
exactly shows you that error message. Then try the java.exe
in same directory to reproduce the error message. Or uninstall all your JRE (JDK may stay) but one, so it is clear which one is running.
Upvotes: 2
Reputation: 3080
Your main method signature is not correct. Please verify that it's like below :
public static void main(String args[]){
}
You may be missing something. Otherwise please give us your method declaration.
Upvotes: 0