无法在 cmd 上使用 javac 编译 .java 文件 [英] Can't compile .java file using javac on cmd
问题描述
我刚开始学习 Java 编程.按照指南/教程,我创建了我的第一个 .java 文件.当我尝试编译 .java 文件时出现问题.
I just started to learn Java programming. Following a guide/tutorial, I created my first .java file. The problem accrued when I tried to compile the .java file.
我已经安装了 Java SE 开发工具包 8u131.我已将用户路径变量设置为 C:Program Files(x86)Javajdk1.8.0_131in
但这不起作用.
I have installed Java SE Development Kit 8u131. I have set the user Path variable to C:Program Files(x86)Javajdk1.8.0_131in
but that didn't work.
我在使用 javac 命令时得到的确切错误如下:'javac' 不是内部或外部命令,也不是可运行的程序或批处理文件.
The exact error I get when using javac command is the following: 'javac' is not recognized as an internal or external command, operable program or batch file.
你们能帮我让 javac 命令工作吗?除了 Path 变量,我不知道还有什么问题.
Can you guys help me get the javac command working? I have no idea what the problem might be besides the Path variable.
推荐答案
首先需要检查JDK安装在哪个目录(Windows操作系统的C盘内),然后按照以下步骤操作:
First you need to check that JDK is installed in which Directory (inside C drive of Windows OS), than follow these steps :
- 转到系统属性 -> 环境变量 -> 系统变量"
- 找到一个名为PATH"或Path"的变量,然后点击编辑"
点击新建并写下你的JAVA路径,然后在任何地方点击确定
- Goto "System Properties -> Environment Variables -> System variables"
- Find a variable named as 'PATH' or 'Path' and click on Edit
Click New and write your JAVA path and click OK everywhere
JAVA 路径:
C:Program FilesJavajdk1.8.0_131in(64 位操作系统)
C:Program FilesJavajdk1.8.0_131in (for 64-bit OS)
C:Program Files (x86)Javajdk1.8.0_131in(适用于 32 位操作系统)
C:Program Files (x86)Javajdk1.8.0_131in (for 32-bit OS)
这篇关于无法在 cmd 上使用 javac 编译 .java 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!