Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find the main class, program will exit

Tags:

java

jar

I made an executable jar with the command prompt in Windows 7 using the

jar cvfm MyJarName.jar manifest.txt *.class 

which created the .jar file. But when I attempt to open it, I get a pop-up window that says

Could not find the main class: <ClassName>. Program will exit. 

Yet, when I use

java -jar jarName.jar 

in the command prompt, it works fine. What's the deal? I want to be able to just double-click it.

like image 774
Pojo Avatar asked Oct 01 '11 02:10

Pojo


1 Answers

Ha, I found what the problem was. I made my program using jdk1.7, but I had jre6 installed. I went and upgraded to jre7, and now it works fine :)

The

java -jar jarname.jar 

line was working in the command prompt because my java path was set to the jdk folder.

like image 111
Pojo Avatar answered Sep 18 '22 18:09

Pojo