user297850
user297850

Reputation: 8005

setting issue of JAVA_HOME and JAVA_PATH

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

Answers (7)

djangofan
djangofan

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

Bimalesh Jha
Bimalesh Jha

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

Russell Shingleton
Russell Shingleton

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

user2573056
user2573056

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

Ruchira Gayan Ranaweera
Ruchira Gayan Ranaweera

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

ajay.patel
ajay.patel

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

Nasir
Nasir

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

Related Questions