Java 使用look n feel库jar创建jar
在我的java项目中,我有look n feel jar文件Java 使用look n feel库jar创建jar,java,executable-jar,Java,Executable Jar,在我的java项目中,我有look n feel jar文件 try { UIManager.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaBlackEyeLookAndFeel"); } catch (Exception ex) { } 所以,当我为我的项目创建jar文件时,它会生成jar和一个包含这些外观jar的lib文件夹。当我将这两个文件夹复制到新位置时,效果很好
try {
UIManager.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaBlackEyeLookAndFeel");
} catch (Exception ex) {
}
所以,当我为我的项目创建jar文件时,它会生成jar和一个包含这些外观jar的lib文件夹。当我将这两个文件夹复制到新位置时,效果很好
但当我只复制jar时,它以默认的方式打开
有没有办法解决这个问题呢?检查build.xml文件——您可能需要编辑build.xml文件以将这些JAR文件合并到JAR中
<!-- Change the value of this property to be the name of your JAR,
minus the .jar extension. It should not have spaces.
<property name="store.jar.name" value="MyJarName"/>
-->
<property name="SOR.jar.name" value="MarsRoverViewer"/>
<!-- don't edit below this line -->
<property name="store.dir" value="store"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<delete dir="${store.dir}"/>
<mkdir dir="${store.dir}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<zip destfile="${store.jar}">
<zipfileset src="${store.dir}/temp_final.jar"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
</zip>
<delete file="${store.dir}/temp_final.jar"/>
</target>
必须将lib文件夹与jar文件一起复制,因为它们是外部添加的jar文件。