1. Adding resource folder to classpath:
When you Clean-&-Build a NetBeans Ant Based Project it creates a manifest.mf file in the root directory of the project. This file gets included in the JAR file also. Modify this file and add entry like follows:
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Class-Path: arts/
slash is important after arts in the class path.
Including the arts resource folder in the distribution
Either copy this folder in the dist folder after the build or add a ANT target to copy the required resources in the dist folder.
2. Add the target like as follows in the build.xml file:
<target name="-post-jar">
<mkdir dir="${dist.dir}/resources"/>
<copy todir="${dist.dir}/resources">
<fileset dir="${basedir}/resources" />
</copy>
</target>
3. Code to access such resources:
The code needed to access such resource files shall be as follows: (This will not work in design time but surely from the JAR file)
// pay attention to relative path
URL resource = ClassLoader.getSystemResource("gui/refresh.png");
ImageIcon tmp = new ImageIcon(resource);
NOTE: The files manifest.mf and build.xml located in the root directory of the project are accessible from the Files Panel in NetBeans IDE
分享到:
相关推荐
db2java.jar db2java.jar db2java.jar db2java.jar
利用httpclient-4.3.1.jar、httpcore-4.3.jar包,很简单的用java实现httpget和httppost请求。
包中含有一个简单的java工程(eclipse)和一个C++工程(VS2013),C++工程有调用java工程的jar包。我会另外写个文档介绍如何调用jar包,在文档原创文档里,自己找
从javacv-platform-1.3.3-bin.zip中抽出来的:javacpp.jar、javacv.jar、javacv-platform.jar、opencv.jar、opencv-android-arm.jar、opencv-android-x86.jar、opencv-linux-armhf.jar 、opencv-linux-ppc64le.jar、...
Appium java 测试框架 jar包
php调用java类的方法 需要将java工程打包称jar包之后调用
Java jar包下载网址,提供了各种版本的jar包文件,供Java开发人员下载
利用这两个jar包,很简单的用java实现httpget和httppost请求。
db2 数据库驱动jar包 db2java.jar,db2jcc.jar,db2_license_cu.jar
java jar工具包查看工具
包含java 常用的所有jar包 常用的jar包 小白再也不用为了jar包头疼
java jar包查看工具,可以查看jar包的class文件
现在很多都是提供jar包,使用Delphi的同学们习惯于调用dll,附件就是一个通过DELPHI XE7调用JAVA的JAR的例子
java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException commons-logging-1.1.1.jar不加这个包 java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory ...
jar包,亲测可用
ant-1.6.5.jar aopalliance-1.0.jar commons-beanutils.jar commons-collections-3.2.jar commons-digester.jar commons- io-1.4.jar commons-pool.jar dom4j-1.6.1.jar msbase.jar mssqlserver.jar msutil.jar ...
包含mysql-connector-java-8.0.22.jar包含mysql-connector-java-8.0.22.jar包含mysql-connector-java-8.0.22.jar包含mysql-connector-java-8.0.22.jar包含mysql-connector-java-8.0.22.jar包含mysql-connector-java-...
C#调用java类、jar包方法C#调用java类、jar包方法C#调用java类、jar包方法C#调用java类、jar包方法C#调用java类、jar包方法。
关于执行java命令引入外部jar包方法
jsde92_sdk.jar, jpe92_sdk.jar, concurrent.jar, icu4j_3_2.jar, ArcObject.jar