You need to configure your environment variables, JAVA_HOME
and PATH
.
JAVA_HOME
must contain the path to java, and you should add %JAVA_HOME%\bin to PATH
Alternatively, you can simply add to your PATH
the whole path to the bin folder, without the JAVA_HOME
variable, however, this makes a little more annoying when you need to have more than one java version on your machine (that way you only need to change JAVA_HOME
and don't even bother with PATH
)
For Windows 7:
Right click on My Computer
Select Properties
Select Advanced System Settings
Select the Advanced
tab
Select Environment Variables
Select Path
under System Variables
Click on the Edit
button
In Variable value editor paste this at the start of the line
C:\Program Files\Java\jdk1.7.0_72\bin;
Click Ok then Ok again
Restart command prompt otherwise it won't see the change to the path variable
Type java -version
in the command prompt.
Notes on Step 8:
Notes on Step 6:
It sounds like you haven't added the right directory to your path.
First find out which directory you've installed Java in. For example, on my box it's in C:\Program Files\java\jdk1.7.0_11
1. Once you've found it, try running it directly. For example:
c:\> "c:\Program Files\java\jdk1.7.0_11\bin\java" -version
Once you've definitely got the right version, add the bin
directory to your PATH
environment variable.
Note that you don't need a JAVA_HOME
environment variable, and haven't for some time. Some tools may use it - and if you're using one of those, then sure, set it - but if you're just using (say) Eclipse and the command-line java
/javac
tools, you're fine without it.
1 Yes, this has reminded me that I need to update...
Assume, Java/JDK is installed to the folder: C:\Program Files\Java:
Follow the steps:
JAVA_HOME
C:\Program Files\Java\bin
, press OK:
Path
C:\Program Files\Java\bin
, press OK:
cmd.exe
and write: java --version
:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With