Lỗi Java Is Not Recognized As An Internal Or External Command

When trying to lớn check the current version of Java in which I am running, I received the error "java is not recognized as an internal or external command, operable program or batch tệp tin.".

Bạn đang xem: Lỗi java is not recognized as an internal or external command

I am running Windows 7 OS và have sầu downloaded the lademo JDK and felt I may have accidentally deleted the java from machine as before I was able to lớn kiểm tra the Java version using the commvà "java -version".

What software must I tải về khổng lồ get Java working on my machine again?

EDIT:

I have managed to get Java running from my cmd again after ensuring all environment variables pointed lớn the current Java SDK.

Xem thêm: Anh Hài Hước Mới Nhất - Những Hình Ảnh Hài Hước Nhất


java
Share
Improve sầu this question
Follow
edited Sep 29 "20 at 16:28
*

NearHuscarl
12.4k55 gold badges3939 silver badges6969 bronze badges
asked Apr 3 "13 at 19:57
*

KarenKaren
2,03933 gold badges1212 silver badges1010 bronze badges
0
Add a comment |

18 Answers 18


Active Oldest Votes
232
You need khổng lồ configure your environment variables, JAVA_HOME & PATH.

JAVA_HOME must contain the path khổng lồ java, và you should add %JAVA_HOME%in lớn PATH

Alternatively, you can simply add to lớn your PATH the whole path lớn the bin thư mục, without the JAVA_HOME variable, however, this makes a little more annoying when you need to lớn have more than one java version on your machine (that way you only need lớn change JAVA_HOME and don"t even bother with PATH)


Share
Improve sầu this answer
Follow
edited Aquảng cáo 3 "13 at 20:06
answered Aquảng cáo 3 "13 at 19:59
*

fcmfcentimet
5,61855 gold badges2222 silver badges3636 bronze badges
5
Add a bình luận |
165
For Windows 7:

Right clichồng on My ComputerSelect PropertiesSelect Advanced System SettingsSelect Advanced tabSelect Environment VariablesSelect Path under System VariablesClichồng on Edit button

In Variable value editor paste this at the start of the line

C:Program FilesJavajdk1.7.0_72in;Cliông chồng Ok then Ok again

Restart comm& prompt otherwise it won"t see the change to the path variableType java -version in command prompt.

Notes on Step 8:1. The version of java in this may be different from the one used here -- this is only an example.2. There will probably be other values in the path variable. It is really important that you don"t delete what"s already there. That"s why the instructions say to lớn paste the given value at the start of the line -- this means that you don"t remove the existing value, you just put java before it. This also fixes any problems you"d be getting if an other version of java is also on the path.

Notes on Step 6:1. This sets the path for the computer, not for the individual user. It may be that you"re working on a computer which other developers also use, in which case you"d rather set the user variables, rather than the system variables