【发布时间】:2021-12-15 19:59:56
【问题描述】:
线
andImg = ImageIO.read(getClass().getResource("gate_and.png"));
失败
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null!
我使用的是Eclipse,在bin文件夹下的导航视图中有gate_and.png文件,提示该文件在构建路径中。
在我的包资源管理器视图中
project/src/view/class - This is the class that has the code above.
和
project/images/gate_and.png
我右键单击项目文件夹 > 构建路径 > 链接源以将图像文件夹添加为源,再次执行此操作会提供确认消息,说明图像已在源中。
我也试过把gate_and.png改成images/gate_and.png和/images/gate_and.png,但是由于图片gate_and.png在bin文件夹下,我觉得原来是对的。
【问题讨论】:
标签: java image ubuntu resources