Getting Started with Java---Development environment configuration under windows and LINUX,UNIX,SOLARIS,FREEBSD

Source: Internet
Author: User
Tags netbeans

First look at the actions under Windows. We need to download the Java SDK jdk. : http://www.oracle.com/technetwork/java/javase/downloads/index.html, click the download button below:


In the download page you need to choose to accept the license and choose the corresponding version according to your own system, this article takes the Window 64-bit system as an example:


After downloading the JDK installation according to the prompts, as well as installing the JDK will also install the JRE, installed on it. Install the JDK, you can customize the installation directory and other information, such as we choose to install directory C:\Program Files (x86) \java\jdk1.8.0_91.

After the installation is complete, we will configure the environment variables. 1. Right-click on "My Computer", click "Properties" and select "Advanced System Settings":


2. Select "Advanced" tab and click "Environment variables":


The screen will then appear as shown:


Set 3 properties in "System variable", Java_home,path,classpath (case does not matter), if already exist then click "Edit", not exist then click "New". The variable setting parameters are as follows:

    • Variable name:java_home
    • Variable value:C:\Program Files (x86) \java\jdk1.8.0_91 //To be configured according to your actual path
    • Variable name:CLASSPATH
    • Variable value:.;         %java_home%\lib\dt.jar;%java_home%\lib\tools.jar; Remember, there's a "." in front.
    • Variable name:Path

    • Variable value:%java_home%\bin;%java_home%\jre\bin;

It is important to note that in Windows10, because of the limitations of the system, the path variable can only use the absolute path of the JDK. The%java_home% will not be recognized, causing the configuration to fail. As shown below:

C:Files(x86)\java\jdk1.  8.0_91\bin;  C:Files(x86)\java\jdk1.  8.0_91\jre\bin;               

Then let's look at the configuration of Java_home:



Then look at the configuration of path:



Then there is the CLASSPATH configuration:


This is the Java environment configuration, after the configuration is complete, you can start Eclipse to write code, it will automatically complete the configuration of the Java environment. It is important to note that if you use more than 1.5 versions of the JDK, you can compile and run the Java program normally without setting the CLASSPATH environment variable.

Next, let's see if the JDK was installed successfully. 1, start, run, type "cmd". 2, type the command: java-version,java,javac Several commands, the following information appears, indicating that the environment variable configuration is successful.


The installation configuration for Windows here is complete. Next, look at the LINUX,UNIX,SOLARIS,FREEBSD environment variable settings. The environment variable path should be set to point to the location where the Java binaries are installed. If the settings are difficult, refer to the documentation for your shell settings. For example, if you use bash as your shell, you can add the following to the end of your. bashrc file: Export Path=/path/to/java: $PATH.

The so-called 工欲善其事 its prerequisite, we in the development of Java language process also need to be good development tools, the current market of many Ides, this article for you recommend the following several Java development tools:

    • Eclipse (Recommended): Another free open source Java IDE,: http://www.eclipse.org/

      Select Eclipse IDE for Java developers:

    • notepad++: notepad++ is a free code editor under the Microsoft Windows environment: http://notepad-plus-plus.org/
    • Netbeans: Open Source free java IDE,: http://www.netbeans.org/index.html

Then we'll be able to run our Java files. Specific running files, refer to the previous article Oh ...

Here are a few more things to explain. In the configuration environment variable set Java_home, one is to facilitate the reference, for example, the JDK installed in the C:\jdk1.6.0 directory, then set Java_home as the directory path, then to use this path later, just enter%java_home%, Avoid entering a long path string for each reference. The second is the principle, when the JDK path changes, only need to change the value of the java_home variable, otherwise, it is necessary to change any of the absolute path reference JDK directory document, if there is no change, a program can not find the JDK, the result is imagined----system crashes. Thirdly, third-party software will refer to the agreed-upon java_home variable, otherwise you cannot use the software normally. In the system environment variable, click the new Java_home (java_home points to the JDK's installation path).

The path variable is set primarily by the path variable that allows us to run Java applications anywhere in the system, such as Javac, Java, Javah, and so on, to find the directory where we install the JDK. Assuming that our JDK is installed in the C:\jdk1.6.0 directory, then in the C:\jdk1.6.0\bin directory is our common Java application, we need to add C:\jdk1.6.0\bin this directory into the PATH environment variable.

    classpath environment variable, When we need to refer to a class that someone else has written when developing a Java program, let the Java interpreter know where to look for the class. In general, Sun provides us with some extra rich class packages, one is Dt.jar, the other is Tools.jar, and these two jar packages are located in the C:\jdk1.6.0\lib directory, so we usually add these two jar packages to our CLASSPATH environment variable. Set classpath=.; C:\jdk1.6.0\lib\tools.jar; C:\jdk1.6.0\lib\dt.jar. Note Type the command when you are finished configuring the environment variable to test whether the JDK is installed successfully: java-version.

Having learned the above, let's look at the differences between JDK and JRE. The JRE (Java runtime enviroment) is the Java Runtime environment. For users of Java programs, not developers. If you download and install only the JRE, your system can only run Java programs. The JRE is the set of environments necessary to run a Java program, including the JVM standard implementation and the Java Core Class library. It includes Java virtual machines, Java platform core classes, and supporting files. It does not contain development tools (compilers, debuggers, etc.). The JDK (Java Development Kit) , also known as J2SDK (JAVA2 Software Development Kit), is the Java SDK, which provides a Java development environment that provides tools such as compiler Javac Used to compile Java files into a class file) and the runtime environment (provides JVM and runtime helper packages for parsing class files to make it run). If you download and install the JDK, you can not only develop Java programs, but also have a platform to run Java programs. The JDK is the core of the entire Java, including the Java Runtime Environment (JRE), a stack of Java tools Tools.jar, and the Java Standard Class library (Rt.jar).

Well, this time the sharing is over. If you feel good, please more praise support oh ...

Original link: 80090049

Getting Started with Java---Development environment configuration under windows and LINUX,UNIX,SOLARIS,FREEBSD

Related Article

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.