One, cmd command
Switch to the D drive: D:
Enter a directory: CD newdir
View a directory of files under: Dir
Java compilation: Javac Helloworld.java, generates class file
Java Runtime: Java helloword.class
Ii. Javac is not an internal command or an external command
Step one: Access to the JDK environment download Step two: Install the downloaded JDK (my default installation letter is C:\Program Files (x86) \java\jdk1.6.0_10). Note: There is no need to change the installation path step six: Now start the specific configuration environment right-click on "My Computer", select "Properties", then "Advanced", click "Environment variables", notice "System variables", click "New" three times, each time create a system variable (note case). Variable name: path variable value: \ c \ default directory \ Bin variable name: java_home variable value: \ c \ default directory variable name: classpath variable value: \ c default directory \lib\tools.jar ; C: \ default directory \jre\lib\rt.jar; After the variable is created, click OK until the Properties window disappears. Step Seven: Open Notepad, enter this code (note case) class HelloWorld {public static void main (String args[]) {System.out.println ("Hello World"); }} Step eight: Save the file in Helloworld.java to D:\java Note: The save address is freely selectable and the file name is case-sensitive. Step nine: Go to "start"-"All Programs"-"Accessories"-"command Prompt" type Javac enter directly, after a few seconds to display the environment test results, the appearance of large English characters is normal. Step Ten: Replace the drive letter to the directory where the Helloworld.java file is located (d:\java>). Type Javac Helloworld.java after a few seconds to return to the directory where the file is located (d:\java>) compiled successfully. Typing Java HelloWorld Displays the Hello world after a few seconds
Third, cannot find or cannot load the main class
ClassPath:.; %java_home%\lib;%java_home%\lib\tools.jar
Java_home:d:\java\jdk1.8.0_11
Path:;%java_home%\bin;%java_home%\jre\bin;
Problems when running Java with cmd