无法在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 Development Kit 8u131.我已经将用户Path变量设置为C:\Program Files(x86)\Java\jdk1.8.0_131\bin
,但这没有用.
I have installed Java SE Development Kit 8u131. I have set the user Path variable to C:\Program Files(x86)\Java\jdk1.8.0_131\bin
but that didn't work.
使用javac命令时出现的确切错误如下:'javac' is not recognized as an internal or external command, operable program or batch file.
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 OS的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 Files \ Java \ jdk1.8.0_131 \ bin(对于64位操作系统)
C:\Program Files\Java\jdk1.8.0_131\bin (for 64-bit OS)
C:\ Program Files(x86)\ Java \ jdk1.8.0_131 \ bin(对于32位操作系统)
C:\Program Files (x86)\Java\jdk1.8.0_131\bin (for 32-bit OS)
这篇关于无法在cmd上使用javac编译.java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!