Created
July 5, 2022 20:51
-
-
Save maxdemaio/daf4fafc5ff15f71dca7cb6a0396bf67 to your computer and use it in GitHub Desktop.
Switch JDK Versions
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
<# | |
Create a file named SJV.ps1 with all of the contents of this file. | |
Open a new powershell window and type "& [path to this file] 17" to switch to Java 17. | |
Type "& [path to this file] 8" OR "& [path to this file]" to switch to Java 8. | |
Note: update paths according to your own machine. | |
You also may need to set an execution policy before running powershell scripts. | |
#> | |
if ($args[0] -eq "17") { | |
$env:JAVA_HOME = 'C:\Program Files\Amazon Corretto\jdk17.0.2_8' | |
} else { | |
$env:JAVA_HOME = 'C:\Program Files\Amazon Corretto\jdk1.8.0_275' | |
} | |
$env:Path = $env:JAVA_HOME + '\bin;'+ $env:Path | |
java -version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment