First check whether JDK is being installed in your system.
C:\> java -version
The output will look something like:
Java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
This means jdk 1.6 is installed and windows knows its path.
Just to ensure set the environment variable PATH to point to java\bin
(For XP)
Right Click My Computer from desktop -> Click Properties -> Click Advanced -> Click
Environment Variables.
In the list you will see a variable PATH being set.
Prepend the jdk path to the variable.
Click on the variable -> click edit -> in the value text box prepend the path
for example, 'C:\program files\java\jdk1.6.0.3\bin;'
Then compile your program as below,
C:\> javac mypgm.java
Finally run the program correcting compilation errors,
C:\> java mypgm
C:\> java -version
The output will look something like:
Java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
This means jdk 1.6 is installed and windows knows its path.
Just to ensure set the environment variable PATH to point to java\bin
(For XP)
Right Click My Computer from desktop -> Click Properties -> Click Advanced -> Click
Environment Variables.
In the list you will see a variable PATH being set.
Prepend the jdk path to the variable.
Click on the variable -> click edit -> in the value text box prepend the path
for example, 'C:\program files\java\jdk1.6.0.3\bin;'
Then compile your program as below,
C:\> javac mypgm.java
Finally run the program correcting compilation errors,
C:\> java mypgm