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
The Current macOS: Unveiling the Latest VersionThe Current macOS: Unveiling the Latest VersionMay 11, 2025 am 12:17 AM

The latest macOS version is macOSSonoma14. macOSSonoma14 brings enhanced desktop widgets and new video conferencing capabilities to improve user experience and productivity.

macOS: An Introduction to Apple's Operating SystemmacOS: An Introduction to Apple's Operating SystemMay 10, 2025 am 12:21 AM

macOS is an operating system designed for Mac computers by Apple, and is highly regarded for its seamless integration, stability and beautiful interface with other Apple devices. It is based on UNIX and provides powerful tools and applications to support creative workers and developers.

macOS: Features, Benefits, and AdvantagesmacOS: Features, Benefits, and AdvantagesMay 09, 2025 am 12:17 AM

The charm of macOS lies in its simplicity and strength, and its core advantages include stability, security and ecosystem. 1. The simple design is reflected in details such as the Dock and Notification Center. 2. Powerful features such as Spotlight Search and Continuity. 3. Unix-based stability and security. 4. Apple's software ecosystem is seamlessly connected and suitable for developers. 5. Multitasking and shortcut key systems improve work efficiency. 6. Performance optimization suggestions include cleaning caches, using virtual desktops and TimeMachine backups.

macOS and Linux: Understanding the Underlying TechnologiesmacOS and Linux: Understanding the Underlying TechnologiesMay 08, 2025 am 12:13 AM

The main difference between the underlying technologies of macOS and Linux is kernel design and file system. 1.macOS uses Mach microkernel and APFS file system to provide stability and efficient storage. 2. Linux adopts a modular kernel design, supports a variety of file systems such as ext4, XFS and Btrfs, to meet various needs.

The Latest macOS: Features, Improvements, and UpdatesThe Latest macOS: Features, Improvements, and UpdatesMay 07, 2025 am 12:15 AM

The latest macOS brings new control centers, performance optimization and enhanced security and privacy controls. 1. The control center integrates commonly used settings to improve operational efficiency. 2. System performance has been improved in startup speed and application response, but attention should be paid to old hardware compatibility. 3. Security and privacy controls are more meticulous, and users can accurately manage application permissions.

macOS: The Evolution of Apple's Operating SystemmacOS: The Evolution of Apple's Operating SystemMay 06, 2025 am 12:04 AM

macOS is an operating system designed by Apple for Mac computers, combining the power of UNIX and the ease of use of Macs. Its main function is to provide an efficient, secure and user-friendly computing environment.

macOS's Latest Version: Release Date and Key DetailsmacOS's Latest Version: Release Date and Key DetailsMay 05, 2025 am 12:05 AM

macOSSonoma14wasreleasedonOctober26,2023.Itintroducesdesktopwidgets,enhancesvideoconferencingwithPresenterOverlayandReactions,andaddsaGameModeforbettergamingperformance.Italsoimprovessystemresponsivenessandsecurity.

The Current macOS: An Overview of Apple's Latest OSThe Current macOS: An Overview of Apple's Latest OSMay 04, 2025 am 12:18 AM

macOSSonoma (14.0) brings new features such as desktop widgets, video conferencing enhancements and performance improvements. 1. The desktop widget allows users to quickly view information. 2. Video conferencing enhancement provides virtual background function. 3. System performance is improved, and application startup and response are faster.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

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.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools