search
HomeOperation and MaintenanceMac OSImplementing coexistence of multiple Java versions under mac

Implementing coexistence of multiple Java versions under mac

1. Environment

macOS High Sierra (Version: 10.13.6)

MacBook Air (13-inch, Early 2015)

2. Solution

1. Create a new .bash_profile file

$ touch .bash_profile

2. Open the .bash_profile file

$ open .bash_profile

3. The solution here is the coexistence of java8 and java11 problem, so enter the following code in the .bash_proflie file

export JAVA_8_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home'
export JAVA_11_HOME='/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home'
# 默认 jdk11
export JAVA_HOME=$JAVA_11_HOME
   
# 动态切换版本
alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
alias jdk11="export JAVA_HOME=$JAVA_11_HOME"

4, and then execute the .bash_profile file

$ source ~/.bash_profile

The above is the detailed content of Implementing coexistence of multiple Java versions under mac. 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: 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.

Is macOS Based on Linux? Debunking the MythsIs macOS Based on Linux? Debunking the MythsMay 03, 2025 am 12:02 AM

No,macOSisnotbasedonLinux;itisbuiltonDarwin,aUnix-basedsystemdevelopedbyApple.1)macOSusesDarwin,whichincorporatesBSDelements,whileLinuxusestheLinuxkernel.2)macOSintegrateswithApple'shardwareforoptimizedperformance,unlikeLinux.3)macOSusesHomebrewforpa

macOS Automation: Mastering Automator & AppleScript for EfficiencymacOS Automation: Mastering Automator & AppleScript for EfficiencyMay 02, 2025 am 12:02 AM

Automator and AppleScript are automation tools that come with macOS, which can simplify daily tasks through graphical programming and scripting languages. 1. Automator creates workflows through drag and drop actions, suitable for codeless users. 2. AppleScript provides higher flexibility and customization capabilities, suitable for complex tasks.

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 Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

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.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),