如何在命令提示符下运行java程序

时间:2022-08-14 20:47:24

How to set the path in control panel.I was been trying to change the path in environmental variables but couldn't succeed .The error it was stating was javac is not recognised as an internal or external command operable program or batch file

如何在控制面板中设置路径。我一直在尝试更改环境变量中的路径,但无法成功。它说明的错误是javac未被识别为内部或外部命令可操作程序或批处理文件

1 个解决方案

#1


2  

Ok,here's what you gotta do. Go to the bin folder where you have java installed. If you havent changed the path during installation, it should be this path:

好的,这就是你要做的。转到已安装Java的bin文件夹。如果您在安装期间没有更改路径,则应该是以下路径:

C:\Program Files\Java\jdk1.7.0_51\bin

Do confirm anyway, as the version may differ & so will the folder name.

无论如何都要确认,因为版本可能不同,文件夹名称也会不同。

Copy this path, including bin.Now,

复制此路径,包括bin.Now,

->right click on My computer, go to Properties.
->Select Advanced System Settings
->Click on Environment Variables
->Under System Variables,select path, & then click on edit.
->keep the previous path as it is,add a semicolon after that & paste the path you copied earlier.

Click ok/apply & you're done.Now you can run all java commands from any directory on your computer.Once again, dont remove the existing path, you gotta add this new one to the existing one,seperate using semi-colon.

单击确定/应用并完成。现在您可以从计算机上的任何目录运行所有java命令。再次,不要删除现有路径,您必须将此新路径添加到现有路径,使用分号分隔。

#1


2  

Ok,here's what you gotta do. Go to the bin folder where you have java installed. If you havent changed the path during installation, it should be this path:

好的,这就是你要做的。转到已安装Java的bin文件夹。如果您在安装期间没有更改路径,则应该是以下路径:

C:\Program Files\Java\jdk1.7.0_51\bin

Do confirm anyway, as the version may differ & so will the folder name.

无论如何都要确认,因为版本可能不同,文件夹名称也会不同。

Copy this path, including bin.Now,

复制此路径,包括bin.Now,

->right click on My computer, go to Properties.
->Select Advanced System Settings
->Click on Environment Variables
->Under System Variables,select path, & then click on edit.
->keep the previous path as it is,add a semicolon after that & paste the path you copied earlier.

Click ok/apply & you're done.Now you can run all java commands from any directory on your computer.Once again, dont remove the existing path, you gotta add this new one to the existing one,seperate using semi-colon.

单击确定/应用并完成。现在您可以从计算机上的任何目录运行所有java命令。再次,不要删除现有路径,您必须将此新路径添加到现有路径,使用分号分隔。