Java First lesson

Source: Internet
Author: User



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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.