我一直试图让getResource整个上午正常工作,但到目前为止,我必须让它工作的唯一方法是将res文件夹移动到bin文件夹,然后像这样使用getResource
URL url = MyClass.class.getResource("/res/gfx/entity/entity1.png");
Run Code Online (Sandbox Code Playgroud)
但是,我有没有办法让它如此res在bin文件夹之外?
Nic*_*tel 13
没关系,我无法相信修复是多么愚蠢.
我将res文件夹添加到主项目文件夹而不是bin,然后进入eclipse
run> run configurations> classpath> select users entries> advanced> add folders> select res
那么当从res调用一个文件夹,而不是做"/res/gfx/entity/entity1.png"时,我做了"/gfx/entity/entity1.png"
问题解决了!
| 归档时间: |
|
| 查看次数: |
9830 次 |
| 最近记录: |