这个错误很奇怪,我的代码编译得很好,我可以看到它没有问题,但是这个错误刚刚出现.我尝试重新启动NetBeans,没有其他异常信息.
是什么导致这个?
已解决,程序所在的位置带有国家符号。
我刚开始学习 Java,但我尝试启动的每个程序(甚至是我课程中的示例程序)都显示错误。
Error: Could not find or load main class "Any class name of program I try start"
C:\Users\Mine\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)
Run Code Online (Sandbox Code Playgroud)
编辑:
代码示例,但发生在任何代码中。
public class Hello {
static void hello(){
System.out.println("Hello, World!");
}
public static void main(String[] args) {
hello();
}
}
Run Code Online (Sandbox Code Playgroud) 我是Java新手,但有一些编程经验.我正在读一本关于如何用Java语言编程的书.我对NetBeans和Java缺乏了解,阻碍了我的进步.我的特殊问题是我的输出框中没有看到正确的输出.无论代码如何.
这是一个例子.我确信我错过了一个小细节:
public class Weather
{
public static void main(String[] arguments)
{
float fah = 86;
System.out.println(fah + " degrees Fahrenheit is ...");
//To conver fahrenheit to Celsius
//Begin by subtracting 32
fah = fah - 32;
//divide the answer by 9
fah = fah / 9;
//multiply that answer by 5
fah = fah * 5;
System.out.println(fah + "degree Celsius is ...");
float cel = 32;
System.out.println(cel + "degress Celsius is ...");
//To convert Farhenheit to celsius
//begin by …Run Code Online (Sandbox Code Playgroud)