这是一个JDK没有配置好的问题。解决办法如下:
测试:
helloworld.java
/*************************************************************************
* Compilation: javac HelloWorld.java
* Execution: java HelloWorld
*
* Prints "Hello, World". By tradition, this is everyone's first program.
*
* % java HelloWorld
* Hello, World
*
* These 17 lines of text are comments. They are not part of the program;
* they serve to remind us about its properties. The first two lines tell
* us what to type to compile and test the program. The next line describes
* the purpose of the program. The next few lines give a sample execution
* of the program and the resulting output. We will always include such
* lines in our programs and encourage you to do the same.
*
*************************************************************************/
public class helloworld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
运行:
本文介绍了当遇到JDK未正确配置导致的问题时的解决步骤。首先检查CMD中java-version命令的输出来验证JDK是否安装正确。如果未安装正确,需要设置环境变量包括Java_Home、Classpath和Path。此外,还提供了一个简单的Java程序示例,用于验证配置是否成功。

2256

被折叠的 条评论
为什么被折叠?



