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.
Advertisement
Answer
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.