views:

130

answers:

5

I have created an application and it is working correctly when I am executing it through NETBEANS.

After that I had clicked on "Clean and Build" to build a SiteScrapper.jar file. Now when I am executing it through command prompt by invoking the following dos command:

java -jar "SiteScrapper.jar"

I am getting the following exception

sitescrapper.Main class not found

My Main class is located in the following package

com.innoConsulting.sitescrapper
+3  A: 

You need to check the value of Main-Class in the Manifest file.

romaintaz
+2  A: 

Your JAR needs a META-INF/manifest.mf file that spells out where the main class is.

duffymo
Of all the answers here, why was this one voted down?
duffymo
+1  A: 

You need to include a manifest file. See here for a quick explanation: http://www.skylit.com/javamethods/faqs/createjar.html

A: 

Make sure that the jar file is 'executable'. The Manifest needs to have the Main-Class attribute.

Andreas_D
+1  A: 

In Netbeans either run the project (and it will ask you for the Main-Class) or go into the Project | Properties | Run and select the Main-Class.

Then do another clean and build and it will generate the JAR file with the appropriate manifest file (with the Main-Class: set).

TofuBeer