Reputation: 34745
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
Upvotes: 2
Views: 2411
Reputation: 61536
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).
Upvotes: 1
Reputation: 114787
Make sure that the jar file is 'executable'. The Manifest needs to have the Main-Class attribute.
Upvotes: 0
Reputation: 329
You need to include a manifest file. See here for a quick explanation: http://www.skylit.com/javamethods/faqs/createjar.html
Upvotes: 1
Reputation: 308813
Your JAR needs a META-INF/manifest.mf file that spells out where the main class is.
Upvotes: 3
Reputation: 81627
You need to check the value of Main-Class
in the Manifest file.
Upvotes: 3