Skip to content

Instantly share code, notes, and snippets.

@peat-psuwit
Created December 16, 2018 10:55
Show Gist options
  • Save peat-psuwit/3252aff770c09d31a1607fb0ecf9bf3f to your computer and use it in GitHub Desktop.
Save peat-psuwit/3252aff770c09d31a1607fb0ecf9bf3f to your computer and use it in GitHub Desktop.
@echo off
rem set the version of jdk you would like to use (1.4, 1.5, 1.6, etc)
set JDK_Version=1.8
set Located=
echo.
echo Locating JDK %JDK_Version%
for /d %%i in ("%ProgramFiles%\Java\jdk%jdk_Version%*") do (set Located=%%i)
rem check if JDK was located
if "%Located%"=="" goto else
rem if JDK located display message to user
rem update %JAVA_HOME%
set JAVA_HOME=%Located%
echo Located JDK %jdk_Version%
echo JAVA_HOME has been set to:
echo %JAVA_HOME%
goto endif
:else
rem if JDK was not located
rem if %JAVA_HOME% has been defined then use the existing value
echo Could not locate JDK %JDK_Version%
if "%JAVA_HOME%"=="" goto NoExistingJavaHome
echo Existing value of JAVA_HOME will be used:
echo %JAVA_HOME%
goto endif
:NoExistingJavaHome
rem display message to the user that %JAVA_HOME% is not available
echo No Existing value of JAVA_HOME is available
goto endif
:endif
rem clear the variables used by this script
set JDK_Version=
set Located=
echo.
echo Put the following hash into Firebase console
"%JAVA_HOME%\bin\keytool" -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android|findstr "SHA1: "
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment