1 Configuring Environment variables
Use the mouse to right-click My Computer, properties, advanced environment variables
new variable name, System variable: Java_home variable Value: C:\Program Files (x86) \java\jdk1.8.0_11Variable name: CLASSPATH variable, system variable, value:.; %javA_home%\lib (Be careful not to omit the current path.;)variable name, editor, System variable: Path is preceded by the value of the variable:%java_home%\bin;2 compiling Java filesJavac Helloworld.java3 Execute class fileJava HelloWorld4. bat file Generationin the document, enter:Javac Helloworld.javaJava HelloWorld@pause
Save As execute file. bat. the role of environment variable configuration:1. Path environment variable. The function is to specify the command search path, execute commands under the I command line as Javac compiles the Java program, it looks in the path specified by the path variable to see if the appropriate command program can be found. We need to add the bin directory in the JDK installation directory to the existing path variable, and the bin directory contains the frequently used executables such as Javac/java/javadoc wait, and after setting the path variable, you can execute the Javac/java tool in any directory. 2. Classpath environment variables. The role is to specify the class search path, to use the already written classes, the premise is to be able to find them, the JVM is through the classpth to find the class. We need to set the Dt.jar and Tools.jar in the Lib subdirectory of the JDK installation directory to classpath, of course, the current directory "." must also be added to the variable. 3. Java_home environment variables. It points to the JDK's installation directory, and software such as Eclipse/netbeans/tomcat finds and uses the installed JDK by searching for java_home variables.
Java file Compilation and operation