jGRASP问题;我不能运行程序? [英] jGRASP problem; I can't run a program?
本文介绍了jGRASP问题;我不能运行程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试运行此代码:
I tried running this code:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
我点击了编译文件按钮,没有出现任何问题,但当我点击运行当前文件的应用程序按钮时,我得到一个弹出窗口,上面写着:以下文件缺少类或内部类文件:C:\ Users \Larry \Downloads \ HelloWorld.java不建议在纠正之前继续进行。我该怎么办?
I clicked the "compile file" button and no problems appeared, but when I clicked on the "run application for current file" button, I got a pop-up that said: "The following file is missing class or inner class files: "C:\Users\Larry\Downloads\HelloWorld.java" Proceeding before correcting is not recommended." What should I do?
推荐答案
除了少数例外,Java期望一个类包含在一个与该类名称完全相同的文件中。对于您在此处描述的代码(public class HelloWorld(...)),编译器希望它位于文件HelloWorld.java中。我怀疑情况并非如此......
With few exceptions, Java expects a class to be contained in a file with exactly the same name as the class. For the code you describe here ("public class HelloWorld(...)"), the compiler wants it to be in a file HelloWorld.java. I suspect that is not the case...
这篇关于jGRASP问题;我不能运行程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文