root/other-projects/expeditee-release-kits/scripts/bin/findjava.bat @ 28740

Revision 28740, 2.6 KB (checked in by ak19, 6 years ago)

Expeditee team (jts21). Add shared/windows folder with self-extracting Java 8 JRE, moved windows_wrapper.cpp to shared/windows/wrapper/wrapper.cpp, fixed run/findjava scripts

  • Property svn:executable set to *
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
20::set HINT=%EXPEDITEE_HOME%\packages\jre
21set HINT=packages\jre
22if exist %SEARCH4J_EXECUTABLE% goto setJexec
23set SEARCH4J_EXECUTABLE=%EXPEDITEE_HOME%\bin\search4j.exe
24if not exist "%SEARCH4J_EXECUTABLE%" goto tryJava
25
26:: JAVA_EXECUTABLE is the value returned by running search4j -e -m MIN_VERSION -p HINT
27:setJexec
28    for /f "tokens=* usebackq" %%G in (`"%SEARCH4J_EXECUTABLE%" -e -m '%MIN_VERSION%' -p %HINT%`) do set JAVA_EXECUTABLE=%%G
29   
30    if "%JAVA_EXECUTABLE%" == "" goto noJava
31    echo Java:
32    echo %JAVA_EXECUTABLE%
33    echo.
34
35    :: we know that works, so we can set the local javahome (for Expeditee) as well
36    for /f "tokens=* usebackq" %%G in (`"%SEARCH4J_EXECUTABLE%" -m '%MIN_VERSION%' -p %HINT%`) do set EXP_JAVA_HOME=%%G
37
38:: found java, JAVA_EXECUTABLE and EXP_JAVA_HOME env vars set, can exit this script
39    goto exit
40
41:tryJava
42if "%JAVA_HOME%" == "" goto noJava
43if not exist "%JAVA_HOME%\bin\java.exe" goto noJava
44    if "%GLILANG%" == "en" (
45        echo.
46        echo ***************************************************************************
47            echo WARNING:
48        echo Java Runtime not bundled with this %PROGNAME% installation.
49        echo Using JAVA_HOME: !JAVA_HOME!
50        echo ^(NOTE: this needs to be %DISPLAY_MIN_VERSION% or higher.^)
51        echo ***************************************************************************
52        echo.
53    )
54    :: Try to use this version
55    set JAVA_EXECUTABLE=%JAVA_HOME%\bin\java
56    set EXP_JAVA_HOME=%JAVA_HOME%
57    goto exit
58
59:noJava
60    echo.
61    if "%EXP_LANG%" == "en" (
62        echo Failed to locate an appropriate version of Java. You must install a
63            echo Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% or greater^) before running the
64            echo %PROGNAME%.
65    )
66    goto exit
67
68:exit
69set SEARCH4J_EXECUTABLE=
70set MIN_VERSION=
71set DISPLAY_MIN_VERSION=
72
73endlocal & set JAVA_EXECUTABLE=%JAVA_EXECUTABLE%& set EXP_JAVA_HOME=%EXP_JAVA_HOME%
Note: See TracBrowser for help on using the browser.