How to include the lib folder in the manifest classpath in Netbeans

那年仲夏 提交于 2019-12-01 01:02:53

Instead of editing the build-impl.xml file you should add this entry to the build.xml file. When you modify anything in your project pertaining to the building of that project, it will generate a new build-impl.xml file.

Here is an example of what I put in my build.xml file:

<target depends="init" name="-do-clean">
    <delete dir="${build.dir}"/>
    <delete file="${dist.jar}"/>
    <delete dir="${dist.dir}/lib"/>
    <delete dir="${dist.dir}/resources"/>
</target>

Since I put this in the build.xml file, it will override the "-do-clean" section of the build-impl.xml file which contains:

<target depends="init" name="-do-clean">
    <delete dir="${build.dir}"/>
    <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
</target>

Furthermore, since it is in the build.xml it won't be modified by Netbeans.

I found a way to acheive this modifying the build-impl.xml.

I changed:

<attribute name="Class-Path" value="${jar.classpath}"/>

to:

<attribute name="Class-Path" value="${jar.classpath} /lib"/>

The problem is that netbeans will overwrite it since this file is automatically generated.

You can simply turn off project option Build/Packaging/Copy Dependent Library and manualy edit manifest.mf in root folder of your project (which is a template for manifest in jar file).

It seems that your problem is the "globmapper" that stores your log4j.xml file in /lib - you'd want it on the "/" or the jar.

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