Add resources to a JAR

混江龙づ霸主 提交于 2019-12-02 08:42:00

Don't place the files on your desktop. Go to the Source folder of your project and copy it in that folder. In NetBeans, any resources you place in the src tree will be automatically copied over to the classes tree when you do a Build (or Clean and Build), except those files matching the "Exclude From JAR File" skeletons specified in Project -> Properties -> Build -> Packaging. So if you pasted it there it should be in your jar file.

Your directory structure should now look like 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

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