0x01 Java learning record - development environment

0x01 Java learning record - development environment

Development environment

This section describes how to build a Java development environment in Windows, Linux, MacOS and other platforms

Windows

plan 1

  1. Download Oracle JDK
  2. Install Oracle JDK
    double-click jdk-8u171-windows-x64.exe and installed in accordance with the corresponding prompts, at the same time you can specify the installation location, the default installation location of the parent directory: C: \ Program Files \ Java
  3. Configuration environment variable
    • Computer -> right click and select Properties -> Advanced System Settings -> Environment Variables
      • A mode: system environment variable manner
        the new system JAVA_HOME environment variable and its value set JDK installation directory
        increase% JAVA_HOME% \ bin before the system PATH environment variable value;
      • Second way: personal environmental variable manner
        new personal JAVA_HOME environment variable and its value set JDK installation directory
        new personal PATH environment variable and set its value% JAVA_HOME% \ bin;
  4. Check the Oracle JDK
    • The default JDK version check command

      java -version
      javac -version
    • Find Java location

      which java
  5. He added that
    because Oracle JDK download Oracle now need to register an account, you can choose OpenJDK release AdoptOpenJDK be used instead.

Linux

plan 1

  1. Download Oracle JDK
  2. Install Oracle JDK
    decompression jdk-8u172-linux-x64.tar.gz to specify the installation location, the default installation location of the parent directory: / usr / lib / jvm /
  3. Configuration environment variable
    to add the following content in the user's home directory .bashrc file and execute source ~ / .bashrc to

    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_171
    export  PATH=${JAVA_HOME}/bin:$PATH
  4. Check the Oracle JDK
    • The default JDK version check command

      java -version
      javac -version
  5. He added that
    because Oracle JDK download Oracle now need to register an account, you can choose OpenJDK release AdoptOpenJDK be used instead.

MacOS

plan 1

  1. Download Oracle JDK
  2. Install Oracle JDK
    double-click jdk-8u171-macosx-x64.dmg and installed in accordance with the corresponding prompt, the default installation location of the parent directory: / Library / Java / JavaVirtualMachines /
  3. Configuration environment variable
    • A way
      to add the following in the user's home directory and execute the .bash_profile file content source ~ / .bash_profile to

      export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home"
    • Second way
      to add the following content in the user's home directory and execute the .bash_profile source ~ / .bash_profile to

      export JAVA_HOME=$(/usr/libexec/java_home)
  4. Check the installation
    • The default JDK version check command

      java -version
      javac -version
    • The default Java installation location check command

      /usr/libexec/java_home
    • Temporary specified Java version

      /usr/libexec/java_home -v 1.8.0_171 --exec javac -version

Scenario 2

Installation by brew

brew tap caskroom/versions
brew cask install java8

Guess you like

Origin www.cnblogs.com/acmeryblog/p/11139767.html