You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

find_java.bat 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. @echo off
  2. call:%~1
  3. goto exit
  4. rem Sets the JAVA_EXE var to be used by the calling script.
  5. rem By default, the java.exe in the PATH is selected. This can be overwritten by the environmental variable SONAR_JAVA_PATH.
  6. rem Returns an error code if Java executable is not found in the PATH and the environmental variable SONAR_JAVA_PATH is not properly set.
  7. :set_java_exe
  8. rem use java.exe from PATH, by default
  9. where "java.exe" >nul 2>nul
  10. if %errorlevel% equ 0 (
  11. set JAVA_EXE="java.exe"
  12. )
  13. rem if the environmental variable SONAR_JAVA_PATH is set, override the default java.exe
  14. if not "%SONAR_JAVA_PATH%"=="" (
  15. if exist "%SONAR_JAVA_PATH%" (
  16. set JAVA_EXE="%SONAR_JAVA_PATH%"
  17. ) else (
  18. echo ERROR: "%SONAR_JAVA_PATH%" not found. Please make sure that the environmental variable SONAR_JAVA_PATH points to the Java executable.
  19. exit /b 1
  20. )
  21. )
  22. if [%JAVA_EXE%]==[] (
  23. echo ERROR: java.exe not found. Please make sure that the environmental variable SONAR_JAVA_PATH points to the Java executable.
  24. exit /b 1
  25. )
  26. exit /b 0
  27. :exit
  28. exit /b