This is an environment variable problem. follow these steps:
1. Environment variable settings:
In system variables (or user variables), click Create:
Variable name: java_home
Variable value: C: \ Program Files \ Java \ jdk1.6.0 _ 10
Click New again:
Variable name: classpath
Variable value:.; % java_home % \ Lib \ tools. Jar
And add it to the path (do not delete the original ones); C: \ Program Files \ Java \ jdk1.6.0 _ 10 \ bin
Then execute the Java and javac commands at the command prompt to see if they can be run.
2. javac is not an internal command:
Run the command directly in cmd mode (the path name ):
Set Path = c: \ Program Files \ Java \ jdk1.7.0 _ 07 \ bin
Set classpath = c: \ Program Files \ Java \ jdk1.7.0 _ 07 \ Lib \ tools. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 07 \ Lib \ DT. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 07 \ bin
3. Add JDK to myeclipse
Window-> preference-> JAVA-> installed jres
Click Add, select standard Vm, and select JDK installation path for jre home, for example, c: \ Program Files \ Java \ jdk1.7.0 _ 07.
Run the following code:
Public class test {
Public static void main (string [] ARGs ){
System. Out. println ("JDK version (Java. Version)" + system. getproperty ("Java. Version "));
}
}
Check whether the version number is correct.