Skip to content

Instantly share code, notes, and snippets.

@aliahmadcse
Last active September 9, 2023 20:31
Show Gist options
  • Save aliahmadcse/d3da628d2de45f75a03937749b032002 to your computer and use it in GitHub Desktop.
Save aliahmadcse/d3da628d2de45f75a03937749b032002 to your computer and use it in GitHub Desktop.
change_java-version
@echo off
set JAVA_HOME=C:\Users\Dell\.jdks\openjdk-17.0.2
setx JAVA_HOME "%JAVA_HOME%"
set Path=%JAVA_HOME%\bin;%Path%
echo Java 17 activated as user default.
move c:\Users\Dell\.m2\*.xml c:\Users\Dell\.m2\settings
echo setting files moved inside successfully
@echo off
set JAVA_HOME=C:\Users\Dell\.jdks\openjdk-17.0.2
setx JAVA_HOME "%JAVA_HOME%" /M
set Path=%JAVA_HOME%\bin;%Path%
echo Java 17 activated as system-wide default.
move c:\Users\Dell\.m2\*.xml c:\Users\Dell\.m2\settings
echo setting files moved inside successfully
@aliahmadcse
Copy link
Author

This script manages the different versions of java on a windows device. Change place all these scripts in a directory and put this directory in the path for easy change of version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment