Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need help creating jar files
Index -> Programming, Java -> Java Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rizzix




PostPosted: Tue Jun 28, 2005 8:47 pm   Post subject: (No subject)

does ur manifest file include a Main-Class field?
Sponsor
Sponsor
Sponsor
sponsor
jin




PostPosted: Tue Jun 28, 2005 9:00 pm   Post subject: (No subject)

Also "java MyProgramName" worked for applet but gave "Exception in thread "main" java.lang.NoClassDefFoundError: Database/class" for application

Database is name of program. is there a way around this.
jin




PostPosted: Tue Jun 28, 2005 9:01 pm   Post subject: (No subject)

Ya it did have a main class field
rizzix




PostPosted: Tue Jun 28, 2005 9:07 pm   Post subject: (No subject)

post ur manifest...
jin




PostPosted: Tue Jun 28, 2005 9:22 pm   Post subject: (No subject)

Manifest-Version: 1.0
Created-By: 1.5.0_01 (Sun Microsystems Inc.)
Main-Class: Database.class
Class-Path: F:\Java\Database
rizzix




PostPosted: Tue Jun 28, 2005 11:06 pm   Post subject: (No subject)

jin wrote:
Manifest-Version: 1.0
Created-By: 1.5.0_01 (Sun Microsystems Inc.)
Main-Class: Database.class
Class-Path: F:\Java\Database


it should be just:
code:
Main-Class: Database
assuming ur using the default package..
jin




PostPosted: Wed Jun 29, 2005 8:33 am   Post subject: (No subject)

i made the change and it created the jar but when i try to open it i get error "Could not find Main-Class. Program will exit".
rizzix




PostPosted: Wed Jun 29, 2005 10:21 am   Post subject: (No subject)

obviously that assumes Database has the public static void main(String[] args) method.. if it doesn't then it is not the main class.
Sponsor
Sponsor
Sponsor
sponsor
1of42




PostPosted: Wed Jun 29, 2005 1:22 pm   Post subject: (No subject)

rizzix wrote:
obviously that assumes Database has the public static void main(String[] args) method.. if it doesn't then it is not the main class.


I bet you that's not the problem... I had this one myself, even though it did have the correct method main signature.

The problem I had was that you must have a newline as the last line in the file; if you don't the manifest doesn't work properly.
jin




PostPosted: Fri Jul 01, 2005 11:14 pm   Post subject: (No subject)

Database is the main class and also adding the extra line did not help i still got the error
1of42




PostPosted: Fri Jul 01, 2005 11:58 pm   Post subject: (No subject)

weird. a manifest i used that worked:

code:
Manifest-Version: 1.2
Created-By: 1.4.2_04 (Sun Microsystems Inc.)
Main-Class: ReWrite

Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 26 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: