2. Building Java Development environment

Source: Internet
Author: User


Previous--chapter1:1, Java language overview

Download Install JDK
    1. Download JDK link from Oracle website

  1. After the download is complete run the installation JDK, the personal likes installs under the D disk;

  2. JDK Installation directory structure:

    • Bin: a command for storing tools, such as Javac,java;

    • DB: Install javadb path;

    • Include: platform-specific header files;

    • JRE: The JRE environment required to run the Java program;

    • LIB: The relevant jar dependency package;

  3. Configure environment variables (WIN10):

    1. Open in turn: Control Panel--System and security--system--Advanced system Setup--environment variable--system variable;

    2. New, variable name: java_home, Variable value: D:\Program files\java\jdk1.8.0_131

    3. Locate path, add:%java_home%\bin (note semicolon)

    4. New, variable name: classpath, Variable value:.; %java_home%\lib\dt.jar;%java_home%\lib\toos.jar; Indicates the current path, used to force the Java interpreter to search for Java classes under the current path, and to separate variables.

      • Note that the Classpath,java command is configured to be recognized, and this place is prone to error, so be sure to pay attention.

  4. To verify the installation:

    Shortcut key Win+r Open Run--cmd, enter Java Run command, javac compile command or java-version, if display is successful installation, so easy!!!

    ?! installation Test

    Set up the environment, we come to run a small program, which is what every programmer knows: HelloWorld

    Install JDK with 1:linux environment:
      1. Download the corresponding version of the JDK, usually the tar.gz suffix file;

      2. Upload to the Linux environment/usr directory via XFTP client;


      3. mkdir Java
        CP jdk-8u161-linux-i586.tar.gz java/

    ?
    4. Configure Environment variables:
    ?
    "' Shell
    Vim/etc/bashrc
    #文件末尾添加
    Export java_home=/usr/java/jdk1.8.0_161
    Export JRE_HOME=${JAVA_HOME}/JRE
    Export Classpath=.:${java_home}/lib:${jre_home}/lib: $CLASSPATH
    Export Java_path=${java_home}/bin:${jre_home}/bin
    Export Path=${java_path}: $PATH
      1. Execute the command to make the configuration effective:source /etc/bashrc

      2. Enter java -version command to view Java version found error:

        -bash:/usr/java/jdk1.8.0_161/bin/java:/lib/ld-linux.so.2:bad ELF interpreter:no such file or directory

        This problem occurs because the JDK and the system version do not match.

      3. Execute command: yum install glibc.i686 Resolve version issue, enter java -version discovery is installed correctly:

        Java Version "1.8.0_161"
        Java (TM) SE Runtime Environment (build 1.8.0_161-b12)
        Java HotSpot (TM) Client VM (build 25.161-b12, Mixed mode)

        ?

    Next--chapter1:3, the first Java program

    ?

2. Building Java Development environment

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.