Use JAVA_HOME on windows if defined
@@ -3,6 +3,12 @@ setlocal
set BASENAME=apktool_
chcp 65001 2>nul >nul
+set java_exe=java.exe
+
+if defined JAVA_HOME (
+set java_exe="%JAVA_HOME%\bin\java.exe"
+)
+
rem Find the highest version .jar available in the same directory as the script
setlocal EnableDelayedExpansion
pushd "%~dp0"
@@ -30,7 +36,7 @@ if "%ATTR:~0,1%"=="-" if "%~x1"==".apk" (
)
:load
-java -jar -Duser.language=en -Dfile.encoding=UTF8 "%~dp0%BASENAME%%max%.jar" %fastCommand% %*
+%java_exe% -jar -Duser.language=en -Dfile.encoding=UTF8 "%~dp0%BASENAME%%max%.jar" %fastCommand% %*
rem Pause when ran non interactively
for /f "tokens=2" %%# in ("%cmdcmdline%") do if /i "%%#" equ "/c" pause
