Jar file execution error
Hello, I wrote a program that runs fine, however packaging the file into a jar file and trying to execute that fails.
The project consists of three files : CinReader.java --> CinReader.class PageSource.java --> PageSource.class LocalBot.java --> LocalBot.class (main class)
The contents of manifest.txt are : Main-Class: LocalBot.class
I created the jar file with the command :
C:\Users\ioil\Desktop\CSCI20\localBot>jar cvfm LocalBot.jar manifest.txt *.class
added manifest adding: CinReader.class(in = 5908) (out= 3027)(deflated 48%) adding: LocalBot.class(in = 362) (out= 272)(deflated 24%) adding: PageSource.class(in = 5293) (out= 2560)(deflated 51%)
Now when I enter the command : "java -jar LocalBot.jar" or "LocalBot.jar" the Java Virtual Machine Launcher returns the error message : "Could not find the main class: LocalBot. Program will exit"
Am I doing anything obviously wrong . . .
Is LocalBot part of a package - ie does LocalBot.java start with the line "package whatever;"? If so the package has to be mentioned in the manifest as part of the full name of the class.
The name of the class is LocalBot (assuming there is no package) not LocalBot.class as you have in the manifest.txt file.
The manifest.txt file should end in a newline.
I fixed it, thanks very much,