dev-resources.site
for different kinds of informations.
Change the default Java Version on macOS
Published at
2/19/2022
Categories
macos
java
jdk
javase8
Author
rithvik78
Author
9 person written this
rithvik78
open
Here, We are trying to change the version to Java SE 8
First run /usr/libexec/java_home -V
which will output something like the following:
Matching Java Virtual Machines (3):
16.0.2 (x86_64) "Oracle Corporation" - "Java SE 16.0.2" /Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home
1.8.202.08 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_202 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home
Pick the version you want to be the default (1.8.0_202) then:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_202`
Now when you run java -version
you will see:
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
Add the
export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_202`
line to your shell’s init file.
Updating the .zshrc file should work:
nano ~/.zshrc
paste the line
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0_202)
at bottom of the file.
Press CTRL+X
to exit the editor, Press Y to save your changes.
source ~/.zshrc
echo $JAVA_HOME
java -version
Output should be:
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
Resources
jdk Article's
30 articles in total
Garbage Collection in Java: Progress Since JDK 8
read article
Day 5 - sudo,apt,jdk
read article
1.What is APT in Linux?2.what is JDK in Linux?3.what happened behind the screen, after we entering JavaC?
read article
Preparando o ambiente de desenvolvimento da melhor API de tabelas de campeonato que você já viu!
read article
Java Compilation Process : From Source Code to Bytecode Execution
read article
Java JVM, JRE and JDK
read article
Exploring the New Features of Java 23
read article
# Must-Know Features in JDK 23: What’s New for Java Developers? 🚀
read article
Enhancing Performance with Static Analysis, Image Initialization and Heap Snapshotting
read article
JDK Setup On Linux, Windows, Mac
read article
Memory Management in GraalVM Native Image
read article
Fundamental Questions of Java
read article
Tổng quan về công nghệ java
read article
El Anuncio de Microsoft: Microsoft Build for OpenJDK 21
read article
Using JDK21 Preview Features and/or incubator classes
read article
How to Install Java JDK 17 on Windows 10
read article
VSCode Java Extension Pack Auto Config
read article
How to install Java in Pop!_Os
read article
Getting Started with Java Programming: Downloading and Installing JDK and IntelliJ
read article
Como intalar o Java JDK 17 no Ubuntu 22.04
read article
Instalando o JDK 17 ou 21 no Windows 11
read article
Spring boot 2.7.7 application deployment on Glassfish 6.2.3
read article
Step-by-Step Guide to Migrating from Java 8 to Java 17 (or Later): Tips, Checklist and Best Practices
read article
Switching between multiple versions of various tools
read article
Encryption raised an exception
read article
Install Java JDK on Arch Linux
read article
JDK vs JRE vs JVM: Asosiy Farqlari
read article
JVM, JDK,JRE ve ClassLoader Nedir ?
read article
Change the default Java Version on macOS
currently reading
The state of pattern matching in Java 17
read article
Featured ones: