命令提示符无法找到或运行我的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 Files\Java\jdk1.8.0_151\bin\ 。(当前版本为 1.8.0_151
)。在cmd输入中, java和 javac起作用,直到我尝试找到文件名 HelloWorld.java或 HelloWorld。如何获取cmd查找并运行我的Java文件?谢谢!
I have already set the path to "C:\Program Files\Java\jdk1.8.0_151\bin\".(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:\温度
类型 javac HelloWorld.java
键入 java HelloWorld
这篇关于命令提示符无法找到或运行我的Java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!