Java 将图像导入Eclipse
我正在尝试将图像导入到我的eclipse项目中。现在,要将图像分配给我正在使用的BuffereImage,请执行以下操作:Java 将图像导入Eclipse,java,eclipse,image,import,paint,Java,Eclipse,Image,Import,Paint,我正在尝试将图像导入到我的eclipse项目中。现在,要将图像分配给我正在使用的BuffereImage,请执行以下操作: try{ player = ImageIO.read(new File(javax.swing.filechooser.FileSystemView.getFileSystemView().getHomeDirectory() + "\\")); } catch (Exception e){ e.printSt
try{
player = ImageIO.read(new File(javax.swing.filechooser.FileSystemView.getFileSystemView().getHomeDirectory() + "\\"));
} catch (Exception e){
e.printStackTrace();
}
我必须得到用户桌面的路径,游戏的用户必须把游戏和图像放在他们的桌面上,这很烦人
问题-如何将图像导入到eclipse项目中,以便使用:
新文件(“filename.png”)
图像将与项目jar一起导出,并且仍然有效吗
注意-我以前尝试过将图像放入src文件夹或Project文件夹,但我想我在Eclipse中弄坏了一些东西,它没有将png识别为png
参考:只需打开Project->Build Project。单击参考资料。查看制作项目的目的地(例如,默认情况下,它是workspace)。 现在将要导入的图像放置在该项目的bin文件夹中