java - Add resources to a JAR -


i want include resources fils (images, textfiles...) in jar. added asset folder classpath, program works fine when run in netbeans.

but if build project, receive error :

not copying library c:\users\flow\desktop\cp , it's directory. 

is normal error ?

so tried add assets manualy :

<target name="-post-jar">         <jar destfile="dist/monprojet.jar" update="true">             <fileset dir="c:/users/flow/desktop/cp">                 <include name="assets/*"/>             </fileset>         </jar> </target> 

but not work. wrong ? sorry english , thank help.

don't place files on desktop. go source folder of project , copy in folder. in netbeans, resources place in src tree automatically copied on classes tree when build (or clean , build), except files matching "exclude jar file" skeletons specified in project -> properties -> build -> packaging. if pasted there should in jar file.

your directory structure should this:

project0     -build         --classes             ---asset             ---project0         --empty      -nbproject         --private      -src         --asset         --project0      -dist     -test  

source: http://www.coderanch.com/t/511437/java/java/adding-images-jar-files-netbeans


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -