[Java tutorial 02] development environment setup, java02

Source: Internet
Author: User

[Java tutorial 02] development environment setup, java02

After a brief introduction to Java in the previous article, I think everyone has a preliminary understanding of her! So before we officially learn how to use Java, we have to do one step. What is it? There is no error, that is, the title of this article, that is, building a Java development environment. Let's officially enter the topic!

Because Java currently supports almost all mainstream platforms, and the Environment Construction is similar, I will take two systems that are widely used as examples (I will not talk about them if I can't afford Mac ...).

First we go to jdk official: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Since Java 9 was just launched, we can use it to try out its advantages and technologies. We still need to try more. This should be the case after you go in. Select the version you want to download based on your current operating system, and click Download.

Windows Installation Process

In fact, installing jdk on Windows is very simple. I directly attach the operation diagram and you can simply execute it in the order of images.

First, find the jdk we just downloaded and double-click it to run it. The installer will pop up.

 

Click Next.

If you do not want to install it on drive C, click Change, select the drive letter you want to install, and then click Next.

Wait until the installation progress bar is executed.

Click Next and wait for the progress bar to finish.

After the installation is completed, a prompt is displayed, and you can click Close directly.

Are you very happy? Don't worry, young man. It's not over yet !!!

Open the command window, enter java-version to view the version information, and check whether the installation is successful.

Environment variable configuration

If the jdk version information is printed, the installation process is successful!

I'm not so excited, but I'm so excited that I can stop it first. Although the installation is successful, there are some restrictions on the use, for example, you find the installed java directory, enter the bin directory in jdk, for example, my is C: \ Program Files \ Java \ jdk-9.0.4 \ bin

Enter cmd in the current window and press enter to enter the Dos window.

Enter javac in the Command window and press Enter. You will find the usage information of javac.

However, if you enter javac in a Dos window in another directory, you will find that they do not know this javac and print the information shown in

Why doesn't he know it in other directories? Because javac in Java \ jdk-9.0.4 \ bincontents under the existence of javac.exe ah, so I use my home things, certainly can use ah, other people without course can't use it! So how can we use the items in the bin directory in other directories? In this case, we need to configure an environment variable for windows!

Someone may ask, what is environmental variable? Well, the old man expected you to ask this question. It is a very good habit to answer your questions. I am sure I can fully support it.

Environment variables generally refer to the parameters used to specify the operating system runtime environment in the operating system, such as the Temporary Folder location and system folder location. An environment variable is an object with a specific name in the operating system. It contains the information that one or more applications will use. For example, in Windows and DOS operating systems, when the system is required to run a program without telling it the complete path, the system not only looks for this program under the current directory, you should also find the path specified in the path. You can set environment variables to better run processes.

The above is from Baidu. Does it look very professional. In other words, environment variables are equivalent to some parameters set for the system or user applications. The specific role is related to the specific environment variables. For example, path tells the system that when the system is required to run a program without telling it the complete path of the program, the system searches for this program under the current directory, which directories should be searched.

Which environment variables should be configured in java? Let's configure it again.

Right-click my computer and select properties. The following window is displayed.

Click Advanced system settings. The following window is displayed.

Click environment variable. In the displayed window, click Create.

Click Create. The variable name is "JAVA_HOME" (copy the content in my quotation marks, without quotation marks or the same below). The variable value is displayed, it must be the path when jdk is installed by myself. For example, if my installation path is E: java \ jdk \, you also need to pay attention to the path problem.

Next, find "CLASSPATH". If not, click "new"

Variable name: "CLASSPATH" variable value ".; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar ;"

Find the Path and edit it. If windows7 directly adds "; % JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin;" to its original variable value ;", for win10, click New to add % JAVA_HOME % \ bin and % JAVA_HOME % \ jre \ bin to the path environment variable,

 

Remember to confirm the two items.

After the configuration is complete, we need to verify whether the configuration is successful by using commands such as javac globally. Click win + R on the keyboard, Enter cmd, open the command window, enter the javac command we just run, and press Enter. Is there anything I can find?

The Dos window directly prints out the usage of javac. Someone may ask: Didn't we see it when we just installed it? Old Brother, please note that the path in the red box does not exist !!! It's not the jdk directory. It means we can use these java commands in other directories! If not, open the Dos window in any directory and enter javac for verification. In this way, we will be able to build a java environment on windows!

If I don't help my grandmother, I just need to serve myself, hey ~

Linux

I finally finished the setup of the windows environment. After reading the above section, I was too impressed !!! I should have explained how to build a development environment on Linux, but after my consideration, I plan to give up editing this part. Some may ask: Why don't you write Linux?

There are too few developers who directly use Linux. Now Linux is mainly used for running services on servers after our program is written. However, it is undeniable that there are indeed a few people who choose to use Linux for development. Some of them are pure technical geeks and are used to using the vim editor. The other is to use the Linux GUI for development, this kind of person... I think it is hard to understand. You don't need to use Linux for the graphic interface!

I think most of the people who read this article are not technical secrets, right? So what are we doing? I don't even want to run it. Isn't it too anxious?

Here I am going to criticize myself for ten seconds ........

As for Linux, there will certainly be a chance to become familiar to you later ~

Reprinted, please note: Dumeng Bell» [Java Review 02] Development Environment Construction

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.