简体   繁体   中英

how to run a java program in command prompt

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

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:

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,

->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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM