A bash script for easily switching which Java version your system should be using on macOS.
A script that will show you a list with currently installed Java versions on your system to pick one from to use.
It works by renaming the Info.plist
files of all other versions inside their respective Library/Java/JavaVirtualMachines/jdk{version}.jdk/Contents/
folders to Info.plist.disabled
, so that only the selected version will have an Info.plist
file, this way, only the selected version will work.
- Download or clone the script to your computer
- Open a terminal window, navigate to the location where you saved the file (
cd /<folder>/
) - Run
chmod +x JavaVersionSwitcher.sh
to allow the user to run the script - Run the script:
sudo ./JavaVersionSwitcher.sh
This script modifies your files (Info.plist
files inside Java installation folders), this means that Java versions won't work unless you either run the script again and select a version or rename the Info.plist.disabled
file to Info.plist
inside Library/Java/JavaVirtualMachines/jdk{version}.jdk/Contents/
. Use at your own risk.
Joni Van Roost, [email protected]
JavaVersionSwitcher is available under the MIT license. See the LICENSE file for more info.
Feel free to submit a pull request, open an issue or fork this project. Any help is always appreciated.