1. What are the reasons for introducing Java virtual machines?
Procedure: Source file-Compiler (using JAVAC command)-----binary bytecode file (platform independent)-Interpreter (using Java command)-----executable file
Conclusion: The cross-platform in Java is implemented through the "JVM" (including the interpreter).
2.Java Development Environment Construction
First step: Install the JDK
Step Two: Configure environment variables
"Java_home"--Configuring the JDK installation path
"PATH"--Configures the location of the JDK command file (bin location)
"CLASSPATH"--Configuring the location of the class library file
Step Three: Configuration process
Right-click the computer--"Properties"--"Advanced system Settings"--Advanced--"environment variables"--"System variables"
1) New--java_home--find the installation path of the JDK as the variable value, as on my computer is "F:\JAVA\JDK".
2) Find the path variable that already exists--Specify the paths to the bin directory in the JDK at the top of the variable value. Note: Use semicolons (;) to separate the front and back paths.
3) New--classpath--Find the path copy of the Lib directory in the JDK--Enter a dot in the variable value "." (representing the current path), separating the path by entering a semicolon ";", and then immediately following the copied path.
3. Write a program in Notepad
First step: First open a Notepad and enter the following code in Notepad:
public class test{
public static void Main (string[] args) {
System.out.println ("Hello World");
}
}
Save to one of the drive characters and name it Test.java (note here that you need to match the name of the class in Notepad with the name of the Notepad).
Step Two: Keyboard w+r and enter CMD to open the command line, on the command line first go to the path you saved Notepad (here my path is the e-drive, so enter "E:"), and then enter:
------Javac Test.java---------"role: Converts a. Java source program into a. Class bytecode file, and a. class file is found in the storage path of Notepad.
------java Test---------"role: Interpreting bytecode files for execution"
Java First lesson