Java Installation

Last login: Fri Sep 9 10:17:47 on console
asawin@Asawins-MacBook-Air ~ % java -version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

asawin@Asawins-MacBook-Air ~ % java –version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

asawin@Asawins-MacBook-Air ~ % echo $SHELL
/bin/zsh
asawin@Asawins-MacBook-Air ~ % nano
asawin@Asawins-MacBook-Air ~ % /usr/libexec/java_home
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

asawin@Asawins-MacBook-Air ~ % /usr/libexec/java_home -V
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

asawin@Asawins-MacBook-Air ~ % echo $JAVA_HOME

asawin@Asawins-MacBook-Air ~ % echo

asawin@Asawins-MacBook-Air ~ % nano ~/.zshenv

brew install java11

==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/11/manifests/11.0.16.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/11/blobs/sha256:9c4b44dbad256cd0b6c90f35722ffe0748f834b0796029dbec1cc768d7affc87
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:9c4b44dbad256cd0b6c90f35722ffe0748f834b0796029dbec1cc768d7affc8
######################################################################## 100.0%
==> Pouring openjdk@11–11.0.16.1.arm64_monterey.bottle.tar.gz
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

openjdk@11 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have openjdk@11 first in your PATH, run:
echo ‘export PATH=”/opt/homebrew/opt/openjdk@11/bin:$PATH”‘ >> ~/.zshrc

For compilers to find openjdk@11 you may need to set:
export CPPFLAGS=”-I/opt/homebrew/opt/openjdk@11/include”

==> Summary
🍺 /opt/homebrew/Cellar/openjdk@11/11.0.16.1: 672 files, 299.5MB
==> Running `brew cleanup openjdk@11`…
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
asawin@Asawins-MacBook-Air ~ % brew info java11
==> openjdk@11: stable 11.0.16.1 (bottled) [keg-only] Development kit for the Java programming language
https://openjdk.java.net/
/opt/homebrew/Cellar/openjdk@11/11.0.16.1 (672 files, 299.5MB)
Poured from bottle on 2022-09-10 at 09:52:08
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openjdk@11.rb
License: GPL-2.0-only
==> Dependencies
Build: autoconf ✘
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

openjdk@11 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have openjdk@11 first in your PATH, run:
echo ‘export PATH=”/opt/homebrew/opt/openjdk@11/bin:$PATH”‘ >> ~/.zshrc

For compilers to find openjdk@11 you may need to set:
export CPPFLAGS=”-I/opt/homebrew/opt/openjdk@11/include”

==> Analytics
install: 85,077 (30 days), 217,021 (90 days), 689,768 (365 days)
install-on-request: 46,308 (30 days), 120,319 (90 days), 353,944 (365 days)
build-error: 212 (30 days)
asawin@Asawins-MacBook-Air ~ % /usr/libexec/java_home
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

asawin@Asawins-MacBook-Air ~ % sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
Password:
Sorry, try again.
Password:
asawin@Asawins-MacBook-Air ~ % /usr/libexec/java_home
/opt/homebrew/Cellar/openjdk@11/11.0.16.1/libexec/openjdk.jdk/Contents/Home
asawin@Asawins-MacBook-Air ~ % /usr/libexec/java_home -V
Matching Java Virtual Machines (1):
11.0.16.1 (arm64) “Homebrew” – “OpenJDK 11.0.16.1” /opt/homebrew/Cellar/openjdk@11/11.0.16.1/libexec/openjdk.jdk/Contents/Home
/opt/homebrew/Cellar/openjdk@11/11.0.16.1/libexec/openjdk.jdk/Contents/Home
asawin@Asawins-MacBook-Air ~ % java -version
openjdk version “11.0.16.1” 2022-08-12
OpenJDK Runtime Environment Homebrew (build 11.0.16.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.16.1+0, mixed mode)
asawin@Asawins-MacBook-Air ~ % cd \
>
asawin@Asawins-MacBook-Air ~ %
asawin@Asawins-MacBook-Air ~ % cd /
asawin@Asawins-MacBook-Air / % cd /usr
asawin@Asawins-MacBook-Air /usr % ls

X11 X11R6 bin lib libexec local sbin share standalone

asawin@Asawins-MacBook-Air /usr % cd ..
asawin@Asawins-MacBook-Air / % ls

Applications System Volumes cores etc opt sbin usr
Library Users bin dev home private tmp var

asawin@Asawins-MacBook-Air / % ls -lsa /opt/homebrew/Cellar/openjdk@11

total 0
0 drwxr-xr-x 3 asawin admin 96 Sep 10 09:52 .
0 drwxrwxr-x 4 asawin admin 128 Sep 10 09:52 ..
0 drwxr-xr-x 10 asawin admin 320 Sep 10 09:52 11.0.16.1

asawin@Asawins-MacBook-Air / % ls -lsa /opt/homebrew/Cellar/openjdk@11/11.0.16.1/libexec/openjdk.jdk/Contents/Home

total 8
0 drwxr-xr-x 11 asawin admin 352 Aug 13 04:42 .
0 drwxr-xr-x 6 asawin admin 192 Sep 10 09:52 ..
0 drwxr-xr-x 34 asawin admin 1088 Aug 13 04:42 bin
0 drwxr-xr-x 7 asawin admin 224 Aug 13 04:42 conf
0 drwxr-xr-x 5 asawin admin 160 Aug 13 04:42 demo
0 drwxr-xr-x 9 asawin admin 288 Aug 13 04:42 include
0 drwxr-xr-x 72 asawin admin 2304 Aug 13 04:42 jmods
0 drwxr-xr-x 72 asawin admin 2304 Aug 13 04:42 legal
0 drwxr-xr-x 56 asawin admin 1792 Sep 10 09:52 lib
0 drwxr-xr-x 5 asawin admin 160 Aug 13 04:42 man
8 -rw-r–r– 1 asawin admin 1222 Aug 13 04:42 release

asawin@Asawins-MacBook-Air / % ls -lsah /Library/Java/JavaVirtualMachines/

total 0
0 drwxr-xr-x 3 root wheel 96B Sep 10 10:02 .
0 drwxr-xr-x 4 root wheel 128B Aug 11 13:44 ..
0 lrwxr-xr-x 1 root wheel 48B Sep 10 10:02 openjdk-11.jdk -> /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk

asawin@Asawins-MacBook-Air / % java -version

openjdk version “11.0.16.1” 2022-08-12
OpenJDK Runtime Environment Homebrew (build 11.0.16.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.16.1+0, mixed mode)

asawin@Asawins-MacBook-Air / % echo export PATH=”/opt/homebrew/opt/openjdk@11/bin:$PATH” >> ~/.zshrc
asawin@Asawins-MacBook-Air / % source ~/.zshrc

asawin@Asawins-MacBook-Air / % echo $PATH

”/opt/homebrew/opt/openjdk@11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin”

asawin@Asawins-MacBook-Air ~ % nano ~/.zshenv
export JAVA_HOME=$(/usr/libexec/java_home)

asawin@Asawins-MacBook-Air / % source ~/.zshenv

asawin@Asawins-MacBook-Air / % echo $JAVA_HOME
/opt/homebrew/Cellar/openjdk@11/11.0.16.1/libexec/openjdk.jdk/Contents/Home

Git Installation
– ok
– asawin@Asawins-MacBook-Air ~ % git –version
git version 2.32.1 (Apple Git-133)

asawin@Asawins-MacBook-Air ~ % gradle -version
zsh: command not found: gradle
asawin@Asawins-MacBook-Air ~ % brew -v
Homebrew 3.6.0
Homebrew/homebrew-core (git revision 982eff21b95; last commit 2022-09-10)
asawin@Asawins-MacBook-Air ~ % brew install gradle
Running `brew update –auto-update`…
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations

==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
antidote commitlint pyyaml xctesthtmlreport
apophenia objconv schemathesis xwin

==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/manifests/18.0.2.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/blobs/sha256:373ac8b65d
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gradle/manifests/7.5.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gradle/blobs/sha256:022acd562e8
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for gradle: openjdk
==> Installing gradle dependency: openjdk
==> Pouring openjdk–18.0.2.1.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/openjdk/18.0.2.1: 642 files, 309MB
==> Installing gradle
==> Pouring gradle–7.5.1.all.bottle.tar.gz
🍺 /opt/homebrew/Cellar/gradle/7.5.1: 11,340 files, 276.1MB
==> Running `brew cleanup gradle`…
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

asawin@Asawins-MacBook-Air ~ % brew -v
Homebrew 3.6.1
Homebrew/homebrew-core (git revision 593984bfeb4; last commit 2022-09-12)
asawin@Asawins-MacBook-Air ~ % gradle -version

Welcome to Gradle 7.5.1!

Here are the highlights of this release:
– Support for Java 18
– Support for building with Groovy 4
– Much more responsive continuous builds
– Improved diagnostics for dependency resolution

For more details see https://docs.gradle.org/7.5.1/release-notes.html

————————————————————
Gradle 7.5.1
————————————————————

Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.16.1 (Homebrew 11.0.16.1+0)
OS: Mac OS X 12.5.1 aarch64

asawin@Asawins-MacBook-Air ~ % java -version
openjdk version “11.0.16.1” 2022-08-12
OpenJDK Runtime Environment Homebrew (build 11.0.16.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.16.1+0, mixed mode)
asawin@Asawins-MacBook-Air ~ %

Leave a Comment