MacOS uninstalls Java 9 and uses Homebrew to build and configure the Java Development Environment. java9homebrew

Source: Internet
Author: User

MacOS uninstalls Java 9 and uses Homebrew to build and configure the Java Development Environment. java9homebrew
 Install Homebrew (software package management tool under macOS:

/Usr/bin/ruby-e "$ (curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" // enter this command in the terminal

Homebrew is used for the following installation:

Install Java:

Brew cask install java // The latest Java9 command is installed. What I need is Java8 ......

Uninstall Java 9:

Ls/Library/Java/JavaVirtualMachines // view jdk version // uninstall sudo rm-rf/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk // here 9.0.1 is The sudo rm -fr/Library/Internet \ Plug-Ins/JavaAppletPlugin. plugin sudo rm-fr/Library/PreferencePanes/JavaControlPanel. prefPane sudo rm-fr ~ /Library/Application \ Support/Java

Install Java 8:

brew tap caskroom/versionsbrew cask install java8

Install eclipse:

brew cask install eclipse-ide

Configure Java environment variables:

/Usr/libexec/java_home // locate JAVA_HOME location Matching Java Virtual Machines (1): 1.8.0 _ 121, x86_64: "Java SE 8"/Library/Java/JavaVirtualMachines/jdk1.8.0 _ 152.jdk/ Contents/Homevi ~ /. Bash_profile // edit the profile file // press the I key and enter the following code JAVA_HOME =/Library/Java/JavaVirtualMachines/jdk1.8.0 _ 152.jdk/ Contents/HomePATH = $ JAVA_HOME/bin: $ PATHCLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar // then Press esc and enter: wq to save and exit the profile file.

Then run:

source ~/.base_profile  echo ~/.base_profile

Check whether the environment variable is configured successfully:

$  echo $JAVA_HOME/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home

 

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.