【发布时间】:2018-06-23 18:23:01
【问题描述】:
我在尝试编译一个简单的 Java 程序时收到此错误消息。我知道 Stack 上已经有这个问题,但是解决方案(我在编译程序时忘记包含 .java 后缀)仍然对我不起作用。这是程序:
import java.io.Console;
public class Introductions {
public static void main(String[] args) {
Console console = System.console();
// Welcome to the Introductions program! Your code goes below here
String firstName = "Paul";
console.printf("Hello, my name is %s\n", firstName);
console.printf("%s this is learning how to write Java\n", firstName);
}
}
【问题讨论】:
-
你用什么命令编译程序?
-
'javac Introductions.java' 编译它,然后 'javac Introductions' 运行它
-
你需要使用
java来运行它。
标签: java compiler-errors runtime-error