Java 不被识别为内部或外部命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26891675/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java is not recognized as an internal or external command
提问by Mr Empty
So guys I have a huuuuuge problem.
所以伙计们,我有一个 huuuuuge 问题。
I downloaded java jdk 1.8.0_45.
我下载了 java jdk 1.8.0_45。
It was working fine , but because I was making a Runescape Private Server I had to put in my classpath and path in my environmental variables. I did that and when I tried to open java then it said :
它工作正常,但是因为我正在制作一个 Runescape Private Server,所以我不得不在我的环境变量中放入我的类路径和路径。我这样做了,当我尝试打开 java 时,它说:
java is not recognized as an internal or external command
java 不被识别为内部或外部命令
so I figured the classpath and path were wrong. But they weren't , I put them in like this.
所以我认为类路径和路径是错误的。但它们不是,我把它们放在这样的地方。
C:\Program Files\Java\jdk1.8.0_45\bin
C:\Program Files\Java\jdk1.8.0_45\bin
I checked the folders and that is exactly the correct classpath. I tried deleting the classpath and path after to restore it back to normal but that didn't work , it kept saying that java is not recognized. I restarted my pc and even did a system restore but nothing worked.
我检查了文件夹,这正是正确的类路径。我尝试删除类路径和路径以将其恢复正常,但这没有用,它一直说无法识别java。我重新启动了我的电脑,甚至进行了系统还原,但没有任何效果。
NEED HELP.
需要帮忙。
回答by sumanta
set JAVA_HOME=path\to\java-dir upto jdk
将 JAVA_HOME=path\to\java-dir 设置为 jdk
set PATH=%PATH%;%JAVA_HOME%\bin
设置 PATH=%PATH%;%JAVA_HOME%\bin
See https://docs.oracle.com/javase/tutorial/essential/environment/paths.html
请参阅https://docs.oracle.com/javase/tutorial/essential/environment/paths.html
回答by SonalKhodiyar
go to system environment and set you path and class path properly, and it should work. If still have issues, restart the application.
转到系统环境并正确设置路径和类路径,它应该可以工作。如果仍有问题,请重新启动应用程序。
you can also open command prompt after you have set the path, and type in javac to see if the path is set properly or not.
您也可以在设置路径后打开命令提示符,然后键入 javac 以查看路径是否设置正确。