[英]how can i fix this error “Error: Could not find or load main class” in eclipse?
I have to run this code but i am always getting this error and there is nothing wrong with the code or the path. 我必须运行此代码,但我总是收到此错误,代码或路径没有任何问题。
I already tried to restart eclipse and i also tried to run this code on different ways. 我已经尝试重新启动eclipse,我也尝试以不同的方式运行此代码。 The error keeps coming. 错误不断涌现。
package h3;
public class MijnKlasse_q1
{
public static void main(String[] args)
{
int i = 2;
if (i > 0)
{
System.out.print("X");
System.out.print("Y");
}
if (i > 3)
{
System.out.print("Z");
}
if (i == 2) {
System.out.print("N");
System.out.print("X");
System.out.print("Y");
}
}
}
...\\Java\\QuizMaster\\src\\h3 this is the file structure where i keep the files. ... \\ Java \\ QuizMaster \\ src \\ h3这是我保存文件的文件结构。 I made sure the file is named MijnKlasse_q1.java. 我确保该文件名为MijnKlasse_q1.java。
The code seems fine. 代码似乎很好。 Sometimes eclipse is acting weird. 有时日食行为怪异。 I recommend that you try to copy the code to another new project and try to run it again.if this persist you can reinstall eclipse and try it again. 我建议您尝试将代码复制到另一个新项目并尝试再次运行它。如果持续存在,您可以重新安装eclipse并再次尝试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.