Reputation: 8005
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?
Upvotes: 1
Views: 16957
Reputation: 29669
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:
C:\AeroFS\Java\jdk1.7.0_25
C:\AeroFS\Groovy\groovy-2.0.5
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
location.
Upvotes: 0
Reputation: 1504
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){
System.out.println(System.getProperty("java.home"));
}
}
Upvotes: 1
Reputation: 3196
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
Upvotes: 1
Reputation: 287
You should set path and classpath variables. Here's the link you can follow for step by step instructions.
[http://abodeqa.wordpress.com/2012/08/11/how-to-set-path/][1]
Upvotes: 0
Reputation: 35547
Check your path variable in windows environmental variables. At least Java path should be there .
It may looks like this.
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Java\jdk1.7.0\bin
Upvotes: 0
Reputation: 1967
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.
Upvotes: 0
Reputation: 11401
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
C:\Windows\System32\java.exe
Upvotes: 4