【发布时间】:2016-06-03 00:42:14
【问题描述】:
我的程序可以读取图像并在 Eclipse 中将它们显示在屏幕上,但导出后我收到一条错误消息,提示 input == null 并且它不会显示任何图像。
这会调用加载图片函数
SpriteSheet sheet = new SpriteSheet(ImageLoader.loadImage("/textures/sheet.png"));
这是 loadImage 函数
public static BufferedImage loadImage(String path){
try {
return ImageIO.read(ImageLoader.class.getResource(path));
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
return null;
}
纹理文件夹在 jar 中。它可能只是找不到文件。我怎样才能做到这一点?
【问题讨论】:
标签: java eclipse image file export