问题
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:

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:

回答1:
Try one of several other Uber jar tools:
- One-JAR
- Fat Jar
- JarSplice
- Shade Plugin (Maven)
回答2:
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
来源:https://stackoverflow.com/questions/21761664/manifest-mf-reference-main-class-in-jar-file