Skip to content

Commit

Permalink
Notes on Java in MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
dpurge committed Nov 28, 2023
1 parent 7da957d commit 78ecf7f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions content/docs/devops/macos/homebrew.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ brew doctor
brew update
brew shellenv
brew cleanup
brew search xxx
brew info xxx
brew install xxx
brew reinstall xxx
brew uninstall xxx
Expand Down
51 changes: 51 additions & 0 deletions content/docs/devops/macos/java.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Java on MacOS

Install with homebrew:

```sh
brew search java
brew info java
brew install java
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
```

Check:

```sh
ls -lsah /Library/Java/JavaVirtualMachines/
java -version
/usr/libexec/java_home -V
```

Setup `JAVA_HOME` in `~/.zshenv`:

```sh
export JAVA_HOME=$(/usr/libexec/java_home -v"21.0.1")
```

Refresh shell: `source ~/.zshenv`

Install Maven:

```sh
brew install maven
mvn -version
brew list maven
```

Settings are in `/opt/homebrew/opt/maven/libexec/conf/settings.xml`.

To upgrade or uninstall:

```sh
brew upgrade maven
brew uninstall maven
```

Install Java 8:

```sh
brew search openjdk
brew install openjdk@8
# Cannot install - it requires x86_64 architecture
```

0 comments on commit 78ecf7f

Please sign in to comment.