Setting up Java environment (Windows)

Nov1
  • Share

Difficulty: ★☆☆☆☆

1. Download the JDK from Sun.com:
http://java.sun.com/javase/downloads/index.jsp and install it to your Program Files. So your path will be: C:\Program Files\Java\jdk1.x.x_x\bin\

2. Set the Java path in your Windows system.
XP:
Start -> Control Panel -> System -> Advanced -> Environment Variables -> System Variables -> PATH.
Vista:
Start -> Control Panel -> System and Maintenance -> System -> Advanced system settings -> Advanced -> Environment Variables -> PATH

Prepend the path were you installed the JDK to the beginning of the ‘Path‘ variable. (when there are multiple variables, seperate them by a semicolon. (C:\Program Files\Java\jdk1.x.x_x\bin;)
Press OK

3. Check your Java version in the command line:
Start -> Run -> Type: CMD
In Command Line Window type:

java -version

The window will output you a message with version information, like for example:

java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)

One Response to “Setting up Java environment (Windows)”

This does not work always.I have 3 java versions 1.4, 1.5 and 1.6 installed on my machine and using windows 2003 server

The java version being picked up is java 1.6. I removed the reference of java 1.6 from the JAVA_HOME and the PATH variable and set it it point to java 1,5 . I opened a new console and tried java -version

it still points to java 1.6

Cheers,
Amit Agrawal

Amit Agrawal on May 27th, 2009 at 11:39 AM

Leave a comment