*
The moose likes Beginning Java and the fly likes I cant run any jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I cant run any jar files" Watch "I cant run any jar files" New topic
Author

I cant run any jar files

Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
Hey everyone,

I cannot run any jar files.

I downloaded Derby today to play around with databases

I get this error all the time:
"Failed to load Main-Class manifest attribute from
C:\Derby_10\lib\derby.jar"

why is this?

Oh and any other Jars I download is the exact same

davy


How simple does it have to be???
Jeff Mayer
Greenhorn

Joined: Mar 21, 2007
Posts: 9
Davy,

Not every jar file is runnable.
Let's suppose that you create a set of utility classes that you would like to assemble and distribute as a jar file.

It is very probable that none of the classes contained in your jar file has a main method. Maybe it wouldn't even make any sense to have any main method in your classes.

Just to begin with, you cannot directly "run" a jar file if there is no main method to be called in any of its classes. Even if a main method exists, if you would like to run it this way:

java -jar myjarfile.jar

you would need to include a Main-Class entry in the jar's manifest file.

In the case of Derby, you should read its documentation, which explains how you are supposed to use it.
 
jQuery in Action, 2nd edition
 
subject: I cant run any jar files
 
Similar Threads
Can't get a jar to run with dependencies
java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
So I Got This Game, See...
deploying code
Classpath and Jar file