使用Eclipse在Manifest文件中构建ClassPath变量 [英] Building ClassPath variable in Manifest file with Eclipse

查看:233
本文介绍了使用Eclipse在Manifest文件中构建ClassPath变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当将项目导出为jar时,Eclipse是否有一种方法可以在Manifest中的ClassPath变量上输出我想要定义的所有Jars?我想只需点击所需的所有需要​​我的项目的jar,然后让Eclipse输出它就像:

  ClassPath:。 /lib/somejar.jar /lib/otherjar.jar 

谢谢



Eclipse>文件>导出> Java> Runnable JAR文件>将所需的库复制到生成的JAR旁边的子文件夹



它将创建一个MANIFEST.MF,其中所有类路径条目为你的Java项目。您需要有一个工作的启动配置。



Do 使用包需要的库,因为它将创建一个讨厌的Jar-In- Jar-ResourceLoader类到你的jar文件中。你通常不希望这样的东西在那里。



Btw,你试过Maven吗?它会自动为您而设。每次。在所有平台上在所有IDE上独立于您的Eclipse版本。当您在假期时,它也会在您的构建服务器上执行。


Is there a way for Eclipse to output all the Jars I would like to define on my ClassPath variable in the Manifest when exporting a project as a jar? I would like to be able to just click on all the jars I need my project to depend on, and then have Eclipse output it all like:

ClassPath: . /lib/somejar.jar /lib/otherjar.jar

Thanks

解决方案

Yes, there is:

Eclipse > File > Export > Java > Runnable JAR File > "Copy required libraries into a sub-folder next to the generated JAR".

It will create a MANIFEST.MF with all the classpath entries of your Java project. You need to have a working launch configuration.

Do not use "Package required libraries", as it will create a nasty Jar-In-Jar-ResourceLoader class into your jar file. You usually don't want such things in there.

Btw, did you try Maven? It does that for you automatically. Every time. On all platforms. On all IDEs. Independently of your Eclipse version. It does that also on your build server when you're on holiday.

这篇关于使用Eclipse在Manifest文件中构建ClassPath变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆