How to set classpath in manifest file , while creating JAR from eclipse?

时间秒杀一切 提交于 2019-12-10 15:06:52

问题


I am trying to creat JAR file through eclipse. I read some of the threads from

stackoverflow as well as other forums. But nothing is helping.

I have created a separate manifest file like this one.

Manifest-Version: 1.0
Main-Class: Main
Class-Path: gnujaxp.jar iText-2.1.5.jar jcalendar.jar jcommon-1.0.16.jar jfreechart-1.0.13.jar jfreechart-1.0.13-experimental.jar jfreechart-1.0.13-swt.jar junit.jar servlet.jar swtgraphics2d.jar tinyos.jar

I have put all this jars in same project folder.

While exporting i am exporting all resources (meants this jar files also.)

But still i am getting noclassdeffound error when my application tries to load any one of the jar included.

M i wrong anywhere ..

Thanks in advance.


回答1:


If you are using eclipse >=3.4 try "export as runnable jar file" it should generate it correctly.

Otherwhise you can provide your own manifest file in the export as jar dialog.




回答2:


I get this error and find that my manifest needs a space after the jars in the class-path. This includes the ones at the end of the line and end of list, otherwise it mashes them together.




回答3:


Be sure to add an empty line at the end of your Manifest file.



来源:https://stackoverflow.com/questions/2636078/how-to-set-classpath-in-manifest-file-while-creating-jar-from-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!