-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |