source: other-projects/expeditee-release-kits/scripts/bin/findjava.bat@ 28721

Last change on this file since 28721 was 28721, checked in by ak19, 10 years ago

Add scripts to find java and run expeditee, make installer copy scripts to installation directory, and chmod them to be executable

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1@echo off
2
3setlocal enabledelayedexpansion
4
5:: Environment Variables passed in: EXP_LANG
6:: As a result of executing this script, the JAVA_EXECUTABLE and EXP_JAVA_HOME
7:: environment variables will be set, but only if Perl was found.
8
9:findJava
10
11:: We should already be in the folder containing a compiled-up search4j.exe
12:: if this Expeditee is part of an installation.
13:: If search4j.exe is not there, then it means this is an SVN checkout.
14:: In such a case, it's up to the user checking things out to ensure JAVA_HOME
15:: is set and moreover points to the correct version of the Java.
16
17set DISPLAY_MIN_VERSION=1.8
18set MIN_VERSION=1.8.0_00
19set SEARCH4J_EXECUTABLE=search4j.exe
20if exist %SEARCH4J_EXECUTABLE% goto setJexec
21set SEARCH4J_EXECUTABLE=!EXPEDITEE_HOME!\bin\search4j.exe
22set HINT=!EXPEDITEE_HOME!\packages\jre
23if not exist "%SEARCH4J_EXECUTABLE%" goto tryJava
24
25:: JAVA_EXECUTABLE is the value returned by running search4j -e -m MIN_VERSION -p HINT
26:: for /f "tokens=*" %%G in ('"%SEARCH4J_EXECUTABLE% -e -m %MIN_VERSION% -p %HINT%"') do set JAVA_EXECUTABLE=%%G
27:setJexec
28 for /f "tokens=* usebackq" %%G in (`"%SEARCH4J_EXECUTABLE%" -e -m '%MIN_VERSION%' -p '%HINT%'`) do set JAVA_EXECUTABLE=%%G
29 if "%JAVA_EXECUTABLE%" == "" goto noJava
30 echo Java:
31 echo %JAVA_EXECUTABLE%
32 echo.
33
34 :: we know that works, so we can set the local javahome (for Expeditee) as well
35 for /f "tokens=* usebackq" %%G in (`"%SEARCH4J_EXECUTABLE%" -m '%MIN_VERSION%' -p '%HINT%'`) do set EXP_JAVA_HOME=%%G
36
37:: found java, JAVA_EXECUTABLE and EXP_JAVA_HOME env vars set, can exit this script
38 goto exit
39
40:tryJava
41if "%JAVA_HOME%" == "" goto noJava
42if not exist "%JAVA_HOME%\bin\java.exe" goto noJava
43 if "%GLILANG%" == "en" (
44 echo.
45 echo ***************************************************************************
46 echo WARNING:
47 echo Java Runtime not bundled with this %PROGNAME% installation.
48 echo Using JAVA_HOME: !JAVA_HOME!
49 echo ^(NOTE: this needs to be %DISPLAY_MIN_VERSION% or higher.^)
50 echo ***************************************************************************
51 echo.
52 )
53 :: Try to use this version
54 set JAVA_EXECUTABLE=%JAVA_HOME%\bin\java
55 set EXP_JAVA_HOME=%JAVA_HOME%
56 goto exit
57
58:noJava
59 echo.
60 if "%EXP_LANG%" == "en" (
61 echo Failed to locate an appropriate version of Java. You must install a
62 echo Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% or greater^) before running the
63 echo %PROGNAME%.
64 )
65 goto exit
66
67:exit
68set SEARCH4J_EXECUTABLE=
69set MIN_VERSION=
70set DISPLAY_MIN_VERSION=
71
72endlocal & set JAVA_EXECUTABLE=%JAVA_EXECUTABLE%& set EXP_JAVA_HOME=%EXP_JAVA_HOME%
Note: See TracBrowser for help on using the repository browser.