search
HomeOperation and MaintenanceMac OSA brief analysis of installing and uninstalling Java's JDK on Mac (share)

In the previous article "Teach you how to install and configure homebrew using mac (code sharing)", I introduced you how to install and configure homebrew using mac. The following article will help you understand the JDK installation and uninstallation of Java on Mac. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

A brief analysis of installing and uninstalling Java's JDK on Mac (share)

Uninstall steps

Delete java files

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefpane
sudo rm -fr ~/Library/Application\ Support/Java

Manual deletion may not be successful , it is recommended to go into the directory and check whether the file exists.

Delete jdk

#查找当前版本
#输入:
ls /Library/Java/JavaVirtualMachines/
#输出:jdk-9.0.1.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk

Installation

brew tap caskroom/versions
brew cask install java8   # 安装java8
#brew cask install java  #默认安装最新版本

Configure Java environment variables

# 1.定位JAVA_HOME位置
/usr/libexec/java_home

# 2.编辑profile文件
vim ~/.bash_profile

# 3.格式参考

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

# 4.执行生效
source ~/.bash_profile

# 5.检查是否成功
echo $JAVA_HOME

Warning (2019.4. 17) The

brew method can no longer be installed. The official website of oracle cannot be downloaded now (java8). It prompts you to log in. After registering an account, you cannot log in for a long time. Just download it from Baidu Cloud.

The following is the download address, java8 for mac, take it without any thanks.jdk-8u201-macosx-x64 .dmg

New environment java12, project tossing After a long time, I suspected that it was a jdk version problem, so I returned to java8

Recommended learning: Mac OS Tutorial

The above is the detailed content of A brief analysis of installing and uninstalling Java's JDK on Mac (share). For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:禅境花园. If there is any infringement, please contact admin@php.cn delete
macOS: Identifying the Most Recent ReleasemacOS: Identifying the Most Recent ReleaseApr 17, 2025 am 12:02 AM

Use the command line tool "sw_vers-productVersion" to identify the latest system version on macOS. 1. Open the terminal and enter the command to get the version number. 2. This command can be used in the script for version comparison and operation. 3. If you need optimization, you can use the "defaultsread" command to read the system file to obtain version information.

macOS Development: Building Native Apps with Swift & XcodemacOS Development: Building Native Apps with Swift & XcodeApr 16, 2025 am 12:01 AM

To develop macOS applications, you need to use Swift and Xcode. 1. Install Xcode and create a new project. 2. Use InterfaceBuilder to design the interface. 3. Write logical code in Swift file. 4. Utilize advanced features such as protocols and generic optimization code. 5. Use debugging tools to resolve common errors. 6. Optimize performance through asynchronous processing.

macOS: The User Experience and DesignmacOS: The User Experience and DesignApr 14, 2025 am 12:02 AM

The design philosophy of macOS is simplicity, user-centered and highly personalized. 1) The simple user interface allows users to quickly find the functions they need; 2) The user-centric design improves the interactive experience; 3) Personalized settings allow the system to be tailored to users; 4) Excellent performance and stability ensure smooth operation of the system; 5) Hidden functions such as shortcut commands and air-to-air playback improve work efficiency.

Understanding the Current macOS: A Concise GuideUnderstanding the Current macOS: A Concise GuideApr 13, 2025 am 12:02 AM

macOSSonoma is the latest operating system version released by Apple in 2023. 1. It enhances the user experience through new features such as desktop widgets. 2. Rely on the SwiftUI framework to implement these functions. 3. The basic usage includes adding widgets. 4. Advanced usage such as using Automator to create workflows. 5. Common error handling includes checking system resources. 6. Performance optimization is recommended to clean the cache regularly.

How to open macos terminalHow to open macos terminalApr 12, 2025 pm 05:39 PM

Open a file in a macOS terminal: Open the terminal to navigate to the file directory: cd ~/Desktop Use open command: open test.txtOther options: Use the -a option to specify that a specific application uses the -R option to display files only in Finder

How to take screenshots of macosHow to take screenshots of macosApr 12, 2025 pm 05:36 PM

There are four screenshot methods on macOS: shortcut keys, touch bars, preview apps, and third-party apps. After the screenshot, the image will be automatically saved to PNG format on the desktop, and you can adjust the format, delay, save position, and floating thumbnail settings through System Preferences.

How to record macos screenHow to record macos screenApr 12, 2025 pm 05:33 PM

macOS has a built-in "Screen Recording" application that can be used to record screen videos. Steps: 1. Start the application; 2. Select the recording range (the entire screen or a specific application); 3. Enable/disable the microphone; 4. Click the "Record" button; 5. Click the "Stop" button to complete. Save the recording file in .mov format in the "Movies" folder.

How to open a terminal for macosHow to open a terminal for macosApr 12, 2025 pm 05:30 PM

The following five methods can be used to open a macOS terminal: Use Spotlight Search through application folders Use Launchpad to use shortcut keys Command Shift U through terminal menus

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.