Java & Eclipse: Resources in JAR?

女生的网名这么多〃 提交于 2019-12-02 02:53:45

问题


How can I add resources (images) directly into my JAR file? For example, if you open the minecraft.jar (of Minecraft) you can see a few classes and folders with resources.

If I try to put any resources in my /src folder, Eclipse will show them in the Package Explorer which is annoying.

When I decompile Minecraft (Minecraft Coder Pack) there are no resources in the /src folder. How can I add my resources like Minecraft does?

Thanks in advance!!


回答1:


You can just create a new folder and mark it as source folder (rightclick on folder in Eclipse -> Build Path -> Use as source folder). Now you should be able to use the ressources without them being in the /src folder.



来源:https://stackoverflow.com/questions/10883077/java-eclipse-resources-in-jar

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