Java& Eclipse:JAR中的资源? [英] Java & Eclipse: Resources in JAR?

查看:145
本文介绍了Java& Eclipse:JAR中的资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将资源(图像)直接添加到我的JAR文件中?例如,如果您打开minecraft.jar(Minecraft),您可以使用资源查看几个类和文件夹。

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.

如果我尝试将任何资源放在我的/ src文件夹,Eclipse将在包资源管理器中显示这是令人讨厌的。

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

当我反编译Minecraft(Minecraft Coder Pack)时,/ src文件夹中没有资源。
如何添加我的资源,如Minecraft?

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

提前感谢

推荐答案

您可以创建一个新的文件夹并将其标记为源文件夹(右键单击Eclipse中的文件夹 - >构建路径 - >用作源文件夹)。现在你应该可以使用资源,而不是它们在/ src文件夹中。

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.

这篇关于Java& Eclipse:JAR中的资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆