"Java" is not recognized as an internal or external command

When I try to check the current version of Java in which I am running, an error appears: "java" is not recognized as an internal or external command, operating program or batch file. "

I am running Windows 7 and downloading the latest version of the JDK and I feel that I may have accidentally uninstalled java from the machine, because earlier I was able to check the Java version using the "java -version" command.

What software do I need to download to run Java on my machine again?

EDIT:

I managed to run Java again from my cmd after all environment variables pointed to the current java sdk file. Thanks for all the answers to my question, Karen

+61
java
Apr 3 '13 at 19:57
source share
12 answers

You need to set environment variables, JAVA_HOME and PATH .

JAVA_HOME should contain the java path, and you should add % JAVA_HOME% \ bin to PATH

Alternatively, you can simply add the entire path to the bin folder to your PATH without the JAVA_HOME variable, however this is a little annoying when you need to have more than one version of java on your computer (this way you only need to change JAVA_HOME and not even worry about PATH )

+100
Apr 3 '13 at 19:59
source share

For Windows 7:

  • Right click on My Computer
  • Choose Properties
  • Select Advanced System Settings
  • Select the Advanced tab
  • Choose Environment Variables
  • Select Path under System Variables
  • Click the Edit button
  • In the variable value editor, paste this at the beginning of the line

     C:\Program Files\Java\jdk1.7.0_72\bin; 
  • Click OK, then OK again

  • Restart the command line, otherwise it will not see the path variable change
  • Type java -version at the command prompt.

<h / "> Notes to step 8:
1. The version of java in this may differ from the version used here - this is just an example.
2. There are likely to be different values ​​in the path variable. It is very important that you do not delete what has already happened. That's why the instructions say inserting this value at the beginning of the line - this means that you are not deleting the existing value, you just put java in front of it. It also fixes any problems you get if another version of java is also on the way.

Notes to step 6:
1. This is the path for the computer, not for the individual user. You might be working on a computer that other developers also use, in which case you would prefer to set user variables rather than system variables

+57
Oct 18 '14 at 9:46 a.m.
source share

It looks like you have not added the correct directory to your path.

First, find the directory in which you installed Java. For example, on my mailbox this is in C:\Program Files\java\jdk1.7.0_11 1 . Once you find it, try running it directly. For example:

 c:\> "c:\Program Files\java\jdk1.7.0_11\bin\java" -version 

Once you definitely get the version you need, add the bin directory to the PATH environment variable.

Note that you do not need the JAVA_HOME environment variable and it does not take some time. Some tools can use it - and if you use one of them, be sure to install it, but if you just use (say) Eclipse and java / javac command line tools, you are fine without it.




1 Yes, it reminded me that I need to update ...

+37
Apr 3 '13 at 20:00
source share

Follow the following steps

Step 1. Open the windows property, that is (Windows + Pause Break), then go to configure the Advance System. 2. Select the tab Advance β†’ Env.variable β†’ add variable, as shown in the figure. Now open a command prompt and check: 1. java 2. Javac runs successfully. If there is still an error, that is, " java" is not recognized as an internal or external command, "and then check if you have installed jdk twice. If so, uninstall and perform the next step.

+12
Feb 11 '15 at 9:47
source share

For me, it started working after entering :: when starting the system variable path: -


enter image description here

enter image description here


+4
Mar 30 '15 at 18:02
source share

This problem applies to Windows 8. First, copy your java jdk path - for example. C: \ Program Files \ Java \ jdk1.7.0_51 \ bin.

  • On the right side of the "My Computer" icon on your desktop and click "Properties."

  • Select "Advanced System Settings" in the left pane.

  • On the Advanced tab, select Environment Variables at the bottom.

  • In the system variables, select the Path option and edit it.

Paste the path and add ';' at the end - for example, C: \ Program Files \ Java \ jdk1.7.0_51 \ bin;

+2
Aug 02 '15 at 21:15
source share

I had the same problem. Just set the exact java bit on your computer. If your computer is 64 bit, install 64 bit Java. If it is 32 bits, then vice versa :)

+1
Mar 18 '17 at 16:07
source share

if you have cygwin installed in the Windows Box or using the UNIX shell,

 Issue bash#which java 

This will tell you if there is java in your classpath or NOT.

0
May 7 '13 at 6:24
source share

In my case, PATH was SET correctly, but PATHEXT was cleared by mistake with the .exe extension. Therefore, the window cannot find java or anything .exe-application from the command line. Hope this can help someone.

0
Jan 16 '15 at 15:01
source share

I also had this problem. Finally, I authorize her. You must enter a space between "java" and "-". then you should enter "java -version" in cmd.

0
12 Oct '15 at 5:21
source share

I did all this and it did not work for me, but finally I found where I was always wrong :). I did not type a β€œspace” between java and -version. It should be entered as follows: java -version. With a space between "java" and "-version". Now it works for me.

0
Dec 20 '15 at 12:56
source share

My solution was to set the same value (path to the JDK bin folder) in JAVA_HOME and Path

JAVA_HOMEPath

-one
Jan 24 '17 at 21:24
source share



All Articles