JAR file: Could not find main class
Posted
by
ApertureT3CH
on Stack Overflow
See other posts from Stack Overflow
or by ApertureT3CH
Published on 2012-04-13T23:15:36Z
Indexed on
2012/09/03
15:38 UTC
Read the original article
Hit count: 139
java
|executable-jar
Okay, I have a strange problem. I wanted to run one of my programs as a .jar file, but when I open it by double-clicking it, I get an error message like "Could not find main class, program is shutting down". I'm pretty sure I did everything right, the jar should work afaik. I also tried other programs, it's the same with every single one. (I'm creating the .jar's through BlueJ) There is no problem when I run them through a .bat . And here comes the strangest thing of all: The .jar's have worked some time ago (one or two months I guess), and I don't remember doing anything different. It's the same BlueJ-Version. Okay, maybe Java updated and something got messed up... I googled, but I couldn't find a solution. (some people seem to have a similar problem, and it seems to be only them who can't run their .jar's; they uploaded them and other people say the .jar's run fine.) What could be the problem? How can I solve it?
I'd really appreciate some help here. Thank you :)
ApertureT3CH
EDIT: okay guys, you're making me unsure here. Imma check the manifest again, at this unholy time ( 1:34 am ) :P
EDIT2: This is my MANIFEST.MF Manifest-Version: 1.0 Class-Path: Main-Class: LocalChatClientGUI [empty line] [empty line]
The Main class is correct.
EDIT3: Thanks to hgrey: There is nothing wrong with the jar. I can run it from a bat file, which actually should not be different from double-clicking the jar, right? Yet I get the error when clicking it, and it works fine through the bat.
EDIT4: I finally solved the problem. I re-installed the JRE and now it works, although I can't see any version differences.
Thanks to everyone!
© Stack Overflow or respective owner