Search code examples
javamacoshomebrewapple-m1

Java19 to java 17 lts in mac M1 using brew


I installed openjdk19 by brew install java

I want to uninstall this version and reinstall openjdk 17 lts version

how to do that?


Solution

  • to uninstall package you can use one of the commands: brew uninstall packageName in your case:

    brew uninstall java

    The remove Homebrew package command looks like this: brew remove packageName in your case:

    brew remove java

    To install java 17, it is necessary to add version: brew install openjdk@17

    Here is brew documentation how to do it: Homebrew doc And also there is answer how to install Java 17 : macOS - How to install Java 17