开发者

having issue with MANIFEST.MF in jar

I have created jar for my project,I am having problem with MANIFEST.MF. structure of my MANIFEST.MF is as follows:

------------------------
Manifest-Version: 1.0
Main-Class: com.ensarm.niidle.web.scraper.Nii开发者_如何学CdleScrapeManager
Class-Path: /Projects/EnwelibDatedOct13/Niidle/lib/hector-0.6.0-17.jar
----------------------------

when I run this using command:

>>java -jar /usr/local/bin/niidle.jar arguments...

then its working properly..... but I dont want the full Class-Path name.

So when structure of my MANIFEST.MF is as follows: and I want this to run using following Class-Path:

---------------------
Manifest-Version: 1.0
Main-Class: com.ensarm.niidle.web.scraper.NiidleScrapeManager
Class-Path: lib/hector-0.6.0-17.jar
----------------------------

and now when I run this using command:

>>java -jar /usr/local/bin/niidle.jar arguments...

then it is showing error:---

---Exception in thread "main" java.lang.NoClassDefFoundError: me/prettyprint/hector/api/Serializer
    at com.ensarm.niidle.web.scraper.NiidleScrapeManager.main(NiidleScrapeManager.java:21)
Caused by: java.lang.ClassNotFoundException: me.prettyprint.hector.api.Serializer
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    ... 1 more

Please tell me solution for that.....


Obviously, the required library is not on the actual classpath. Here it says:

The URLs in the Class-Path header are given relative to the URL of the JAR file of the applet or application.

So at my understandig, java now looks for the hector library (only) at this location:

/usr/local/bin/lib/hector-0.6.0-17.jar

Note, that if you execute java with the -jar option, the classpath entries are taken from the manefest only, additional entries in -cp or $CLASSPATH are ignored.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜