Accepted answer

the runnable jar contains a file, which defines the main class to be executed when the jar is run.

non-runnable jars are just libraries of classes, that can be added to the classpath so that code is reused (it also contains the manifest file, but no main class there)


in my case, i used to export as a jar when i had all main class and all the libraries path directory specified in the . if many applications are using same library it is unnecessary to export shared library for each jar. it makes running jar faster. but, many times due to configuration issue in different server class-path cannot access library and in that case it makes sense to export the runnable jar that makes file slow to execute and large.


with the standard jar file, you have to specify the class with the main method on the command line when running the jar. with a runnable jar, there is a manifest file that will hold that information so you can just type java -jar myrunnable.jar, or simply double click it.


a runnable jar is a jar file that has an embedded manifest file that includes the "main-class:" declaration. the "main-class" must be defined so the java runtime knows which class to call when the jar is "run." if a jar does not include a manifest with the "main-class:" it is not considered a "runnable jar" - it is just a library of java code.

i would guess this is the difference in how eclipse exports the jar, but not 100% sure.

see this link for more info:

Related Query

More Query from same tag