[英]"make clean all run" works but the project on Eclipse won't run
I'm trying to make a project, that was never used on Eclipse before, work.我正在尝试制作一个以前从未在 Eclipse 上使用过的项目。 Keep in mind that the code is not mine so I don't know everything about it.
请记住,代码不是我的,所以我不知道它的一切。 The project run perfectly fine with Cygwin using "make" with the "make clean all run" command but when I'm launching it on Eclipse, I have this error message:
该项目在 Cygwin 上使用“make”和“make clean all run”命令运行得非常好,但是当我在 Eclipse 上启动它时,我收到以下错误消息:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.awt.Image.getProperty(String, java.awt.image.ImageObserver)" because "image" is null>
线程“main”中的异常 java.lang.NullPointerException:无法调用“java.awt.Image.getProperty(String, java.awt.image.ImageObserver)”,因为“image”为 null>
That error is caused by (the last line in the first code section):该错误是由(第一个代码部分的最后一行)引起的:
private void initClass() {
BufferedImage prefs_image;
prefs_image = MBMImagesDico.loadBestImage(ICON_PREFS_STR,
Transparency.TRANSLUCENT);
_prefs_icon = new ImageIcon(prefs_image);
}
and (the last line in this code section):和(此代码部分的最后一行):
public ImageIcon (Image image) {
this.image = image;
Object o = image.getProperty("comment", imageObserver);
}
because image is null.因为图像是 null。
It seems that Eclipse is not finding the image file that the program is looking for.似乎 Eclipse 没有找到程序正在寻找的图像文件。 So I tried:
所以我尝试了:
And I still didn't find a solution.而且我仍然没有找到解决方案。
I'm using Eclipe 2021-09 (4.21.0) and java 8u202.我正在使用 Eclipe 2021-09 (4.21.0) 和 java 8u202。
I'm including a picture of the path in debug mode and the actual path in the bin.我包括一张调试模式下的路径图片和 bin 中的实际路径。 As you can see, it "should" work.
如您所见,它“应该”起作用。 The path demanded during the execution The path in the bin folder in the project folder
执行过程中需要的路径 项目文件夹中bin文件夹中的路径
It's my first post on StackOverflow so I'm sorry in advance if I didn't include enough informations or I talked too much.这是我在 StackOverflow 上的第一篇文章,所以如果我没有包含足够的信息或我说得太多,我提前道歉。 I'm a bit desperate (it's probably easy to fix).
我有点绝望(它可能很容易修复)。 Wish you all a good day.
祝大家有个美好的一天。
Turns out the problem was that I was using the wrong version of the JRE and had nothing to do with the build path or the source directory.原来问题是我使用了错误版本的 JRE,并且与构建路径或源目录无关。
So this how I fixed it:所以这就是我修复它的方式:
Here is a picture of the "JRE" tab in "Run configuration"这是“运行配置”中“JRE”选项卡的图片
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.