简体   繁体   English

线程“主”错误

[英]Exception in thread “main” error

This is the only error that I see in my code. 这是我在代码中看到的唯一错误。 It is this line: 就是这一行:

public class VolCac extends JFrame implements ActionListener{

This is the error: 这是错误:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 线程“主”中的异常java.lang.Error:未解决的编译问题:

at VolCac.main(VolCalc.java:810)

This is line 810: 这是810行:

public static void main(String[] args){ 
    JFrame frame = new CalcVolume(); 
    frame.setSize(525, 350); 
    frame.setVisible(true); 
                                      }
}

I can't figure why I'm getting the error. 我不知道为什么会出错。

"Unresolved compilation problem" errors at rntime are what happens when your code doesn't compile, but you tell Eclipse to run it anyway. rntime出现“未解决的编译问题”错误,这是当您的代码无法编译时发生的,但是您仍然告诉Eclipse运行它。 The exception will happen at the point where the program can't continue any longer. 异常将发生在程序无法再继续的时候。

In this case, I see a file named "VolCalc," a class named "VolCac", and an attempt to create an instance of "CalcVolume". 在这种情况下,我看到一个名为“ VolCalc”的文件,一个名为“ VolCac”的类,并尝试创建“ CalcVolume”的实例。 I'm pretty sure you mean for all three of these to match! 我敢肯定,您的意思是所有这三个匹配!

That error implies you're running Eclipse. 该错误表明您正在运行Eclipse。 Regardless, your IDE should be telling you what's wrong on that line. 无论如何,您的IDE都应该告诉您该行出了什么问题。 I hope you don't really have ALL that code on one line as you imply! 希望您确实暗示您实际上并没有在一行上包含所有代码!

if you're using eclipse try to clean your project 如果您使用的是eclipse,请尝试清理您的项目

and also your class name is VolCac and your are makine a new CalcVolume Object... 而且您的类名是VolCac,并且您是一个新的CalcVolume对象的机器。

can't say much without seeing more code... 在看不到更多代码的情况下不能说太多...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM