命令提示符无法找到或运行我的 Java 文件 [英] Command Prompt cannot find or run my Java File
问题描述
这里的新程序员,就实际使用编辑器并运行它而言.我创建了一个简单的程序来说明这一点.
New programmer here, in terms of actually using an editor and running it. I have created a simple program that states this.
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}
我已经将路径设置为C:Program FilesJavajdk1.8.0_151in".(当前版本1.8.0_151
").在 cmd 输入中,java"和javac"一直有效,直到我尝试查找文件名HelloWorld.java"或HelloWorld".如何让 cmd 找到并运行我的 java 文件?谢谢!
I have already set the path to "C:Program FilesJavajdk1.8.0_151in".(current version"1.8.0_151
"). In the cmd input, "java" and "javac" work until I attempt to find a file name either "HelloWorld.java" or "HelloWorld". How do I get cmd to find and run my java file? Thank you!
推荐答案
一种尝试方法:
打开C:Temp
(如果不存在则创建)
Open C:Temp
(or create if not exists)
创建名为 HelloWorld.java
打开cmd
输入 cd/d C:Temp
输入javac HelloWorld.java
输入 java HelloWorld
这篇关于命令提示符无法找到或运行我的 Java 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!