Java Note: Part 3: Java programming experience (including configuring Java environment variables)

Source: Internet
Author: User

Java Note: Part 3: Java programming experience (including configuring Java environment variables)

# Daily nagging 1 # My computer crashed the day before yesterday and yesterday. I am sorry if I haven't changed it for two days. After repair, I can use it now. Come and blog

# Daily nagging 2 # Some people said yesterday that Java was so awesome and I was scared. Then I would be even worse, and I would be even more scary. Do you know Python? I tell you, Python is a process-oriented and object-oriented programming language (Ha? I only know that the third-generation programming language is process-oriented if it is not object-oriented)

# Daily nagging 3 # Another person said that he was cheated by the title of yesterday and thought that yesterday he was writing the configuration of Java environment variables. Let's write for you today.

After the JDK is downloaded, how can I install it now? That's right, but I won't talk about the installation. You should know how to install it (crazy next step ). But do you remember? I told you in the previous article that JDK contains JRE? Therefore, when you install JDK, a window will pop up to install JRE. Don't worry. This is not a system bug.

After JDK is installed, the most important step is to configure the Java environment variables. Why is it the most important? Because you do not do this step, the installation of your JDK is equal to that of the white package )). Let's configure it now!

I wonder if you remember the JDK installation path before installing JDK? Remember? (You can find a solution yourself.) Well, okay. Now let's go back to the desktop and right-click my computer/this computer (for environment variable configuration, only the Windows operating system is used. For other operating systems, please Baidu, in addition, for the configuration of Windows Java environment variables, we only use the control panel configuration, do not use the doscommand, and Baidu wants to use the doscommand), select properties:

Next, select Advanced System settings on the right of the displayed window:

(Note: Do not pay attention to other things)

Then select the environment variable:

Then, select new from the system variables:

As shown in the following figure, click "OK:

(Do not enter the sentence I actually typed)

Then, find the Path in the system variable and click Edit:

The following two methods are available depending on the system version or open mode:
1. The following page is displayed:

Select New, enter the two variable values, and then click OK:

 

2. The following page is displayed:

Enter the following variable value at the beginning of the variable value, and then click OK:

(Do not overwrite the original variable value; otherwise, you will not miss the end of your computer; otherwise, most of your computer will be over)

(Branch end)

Then select new from the system variables:

Then, as shown in the following figure, click OK:

Finally, it is also the most important step. Click the OK button (please do not click the close button in the upper right corner so that everything you do will not be saved, we have done it in white (● too many others ● )):

Then click OK:

OK. environment variable configuration is complete.

Then, I am afraid that your configuration will fail, and I will teach you how to check whether the configuration is successful.

Open the Start Menu, find and open "run" (or press the shortcut key to open it), or enter cmd in the following search bar (Windows 10 uses Microsoft xiaona, cannot screenshot ). The following window is displayed:

(It doesn't matter if the content shown above is different, as long as it is a "command prompt)

Enter java and press enter, as long as the result is not:

'Java' is not an internal or external command, nor a program or batch file that can be run.

Enter javac again and press enter, as long as the result is not:

'Javac' is not an internal or external command, or a program or batch file that can be run.

The configuration is complete. What if this happens? Configure the Java environment variable again. What if the problem persists? Reinstall JDK.

So what is the purpose of configuration? Ke can be used to run Java programs, but how can I run the next blog. In addition to running Java programs, there are many other functions After configuring Java environment variables. For example, you can view the Java version:

In DOS (cmd), enter java-version (there is a space between java and-version), and press Enter:

(It doesn't matter if the content is different)

Haha, It's amazing (it's actually not amazing at all )!

Next, let's write the first Java program HelloWorld together.

Create a text document in any folder:

Rename this document as HelloWorld, open this document, and enter:

1 class HelloWorld{2     public static void main(String [] args){3         System.out.println("Hello World!");4     }5 }

(Full English input is used. It is recommended that you repeat it and do not copy it)

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.