Take the 2-minute tour ×

I have been using Eclipse to develop java program on a windows 7 machine. It works. I also typed "java" from the command prompt, it also shows the help message. In other words, I think Java was correctly installed on this machine. However, when I open the "environmental variable" setting on this machine, I cannot find either "JAVA_HOME" setting and "JAVA PATH" setting. What is the problem of this?

share|improve this question
What about JDK_HOME and PATH? There is no such thing as JAVA_PATH as far as I know. –  fge Jul 11 '13 at 14:45
You could run java with only setting Path variable.. –  ritesh Jul 11 '13 at 14:46
If you are able to run java -version and get the result about your java version in command prompt, those variable are configured –  Ruchira Gayan Ranaweera Jul 11 '13 at 14:49
add comment

7 Answers

up vote 0 down vote accepted

Some environment variables are defined at machine level and some are defined (and overwritten) at user account level. Just do following in windows cmd prompt:

c:\echo %PATH% or just type c:\path

and verify the output.

You can also verify java home path by writing a simple Test class like following:

public class Test {
  public static void main(String[]s){
share|improve this answer
After typing c:\echo %PATH%, I did not find "JAVA_PATH" setting in the output. But why Eclipse can still run? Thanks. –  user297850 Jul 11 '13 at 15:00
@user297850 just type c:\set and you can see all the env values defined in your cmd shell. Eclipse just uses the installed JRE (from system path) and it has its own compiler. If it does not find a java on PATH it will throw error and terminate. –  Bimalesh Jha Jul 11 '13 at 15:03
You can use the Test class, I pasted above, inside Eclipse and find out what Eclipse is using. –  Bimalesh Jha Jul 11 '13 at 15:05
add comment

With Java, Groovy, Git, Heroku, Maven, and many other projects, what I always do is this:

1.  Unzip the software package into a directory, for example:

2.  Create a HOME variable, such as JAVA_HOME or GROOVY_HOME that points to the
    above locations.

3.  Put these in your default system path by editing your PATH variable and 
    adding %JAVA_HOME%\bin  and %GROOVY_HOME%\bin to the end of your PATH.  In
    the case of JAVA_HOME only, you might want to put it at the beginning of 
    the PATH to override the java.exe that rests in the WINDOWS directory 
share|improve this answer
add comment

There are multitudes of links to be fond on Google regarding how to solve this in Windows. These environment variables typically do not get setup by default when installing java.

Here are some 10 second finds with with answers:

How to set java_home on Windows 7?

Setting the JAVA_HOME Variable in Windows

Installing Java on Windows 7 and setting-up the JAVA_HOME

share|improve this answer
add comment

You should set path and classpath variables. Here's the link you can follow for step by step instructions.


share|improve this answer
Welcome to Stack Overflow! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  jlordo Jul 11 '13 at 14:53
add comment

Check your path variable in windows environmental variables. At least Java path should be there .

It may looks like this.

share|improve this answer
add comment

Check you PATH variable in Environment Variables. It must be set to jreInstallation/bin. Windows does not pick up java command from JAVA PATH, it picks java command from PATH variable.

Also note that once you install JDK, path is not set by installation to jdkInstallation/bin, you need to set it up explicitly.So unless you set the path to jdkInstallation/bin, javac wont be recognized.

share|improve this answer
In other words, the java was not setup on my machine even I install JDK. However, why Eclipse can still debug and run Java program –  user297850 Jul 11 '13 at 14:58
Because eclipse does not depend on the jdk installation these days. Eclipse has its own compiler so you don't need JDK if you are working with Eclipse. –  zerocool Jul 11 '13 at 15:00
add comment

Java also copies java.exe and javaw.exe under C:\Windows\System32, there's where your java is running from.

You can confirm that by using where commmand:

On my win7 machine:

>where java.exe
share|improve this answer
Interesting... Does it also copy javac et al if you install a JDK? –  fge Jul 11 '13 at 14:51
@fge no. On my win7 box it does not locate C:\Users\xxx>where javac.exe INFO: Could not find files for the given pattern(s). –  Bimalesh Jha Jul 11 '13 at 15:07
add comment

Your Answer


