Sionnach733
Sionnach733

Reputation: 4736

Manifest.mf: reference Main-class in jar file

I am making a runnable jar where my main class is eclipse's JarRsrcLoader.

This is my Package Structure:

org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader

And my Manifest:

Manifest-Version: 1.0
Rsrc-Class-Path: ./selenium-server-standalone-2.39.0.jar
Class-Path: . 
Rsrc-Main-Class: test.Main
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader

And the directory structure within my jar:

enter image description here

When I try to run the jar from command line using:

java -jar output.jar

I get:

Error: Could not find or load main class org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader

Can anyone see where I am going wrong? When i put the org folder in the same directory as output.jar, it runs fine. I want it to be found from within the jar so that there are no external dependencies. Thanks

UPDATE

the classfile is in the jar:

enter image description here

Upvotes: 2

Views: 7213

Answers (2)

likeGreen
likeGreen

Reputation: 1079

Though this was asked long time back, this is what worked for me

Try creating a package in your workspace like com.eclipse.jdt.internal.jarinjarloader and place all the files JarRsrcLoader.java, RsrcURLConnection.java , RsrcURLStreamHandler.java and RsrcURLStreamHandlerFactory.java which can be downloaded from google. Then wrote the Manifest as shown

 Build-Jdk: 1.7.0_55
    Class-Path: .
    Rsrc-Main-Class: com.abc.Master
    Main-Class: com.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
    Rsrc-Class-Path: ./ lib/xyz.jar 

Upvotes: 1

Anthony Accioly
Anthony Accioly

Reputation: 22461

Try one of several other Uber jar tools:

Upvotes: 0

Related Questions