Ethan
Ethan

Reputation: 1266

"Failed to load Main-Class manifest attribute from" a jar on the class path

So I have a java application that requires 2 jars as dependencies. One of the 2 dependencies is a java library I wrote called VT Access, and it does not have a main class. The other dependency jar is jsoup.

So I export my java application including this two jars on the class path from eclipse using the Manifest:

Manifest-Version: 1.0
Main-Class: vt.access.workshop/UI
Class-Path: "C:\Users\ethan\Documents\ACTUAL My Documents\Programs\VT Access API workshop\Dependencies\*"

Now when I go to run the resulting jar I get the error:

Failed to load Main-Class manifest attribute from
.\VT Access.jar

So I don't get what could be the issue, why does this program care if one of it's dependencies has a main-Class?

btw the manifest for Vt Access is here:

Manifest-Version: 1.0
Class-Path: "C:\Users\ethan\Documents\ACTUAL My Documents\Libraries\Java Libraries\jsoup\jsoup-1.6.3.jar"

Upvotes: 0

Views: 1702

Answers (1)

JB Nizet
JB Nizet

Reputation: 691645

Your class name is invalid:

vt.access.workshop/UI

should be

vt.access.workshop.UI

Moreover, I'm not sure you can use absolute paths in the classpath, and I'm even less sure you can use wildcards. And I'm also pretty sure the classpath is not transitive, so you should use relative path, and ad all the jar files your jar depends on in the classpath:

Class-Path: jsoup-1.6.3.jar vtaccess.jar

If you add these libraries to a subdirectory, use foward slashes and not backslashes. And remove white spaces from the jar file name:

Class-Path: lib/jsoup-1.6.3.jar lib/vtaccess.jar

See the Java tutorial for more information.

Upvotes: 1

Related Questions