set TEMP_FILE=java.txtjava
mvn -v | find "Java home" > %TEMP_FILE%token
for /f "tokens=3 delims= " %%i in (%TEMP_FILE%) do set JAVA_HOME=%%iim
del /s /q %TEMP_FILE%mv
echo %JAVA_HOME%