[英]Exporting java body with imagine into jar w/ images
I wrote code that works whenever i run in Eclipse, but whenever i try to export it into a runnable Jar, my images dont show up.我编写的代码在 Eclipse 中运行时可以正常工作,但是每当我尝试将其导出到可运行的 Jar 中时,我的图像都不会显示。
For my images this is the code being used pic1=ImageIO.read(FourCournersRunner.class.getResource("/Images/1.png"));
对于我的图像,这是正在使用的代码pic1=ImageIO.read(FourCournersRunner.class.getResource("/Images/1.png"));
When exporting the project I've chosen "Package required libraries into generated JAR":导出项目时,我选择了“将所需的库打包到生成的 JAR 中”:
Images
folder to the .jar file?您是否也将Images
文件夹打包到 .jar 文件中?In short, I don't think the code you provide right now can reproduce the problem.简而言之,我认为您现在提供的代码无法重现该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.