Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 1 | @echo off
|
| 2 | rem Licensed to the Apache Software Foundation (ASF) under one or more
|
| 3 | rem contributor license agreements. See the NOTICE file distributed with
|
| 4 | rem this work for additional information regarding copyright ownership.
|
| 5 | rem The ASF licenses this file to You under the Apache License, Version 2.0
|
| 6 | rem (the "License"); you may not use this file except in compliance with
|
| 7 | rem the License. You may obtain a copy of the License at
|
| 8 | rem
|
| 9 | rem http://www.apache.org/licenses/LICENSE-2.0
|
| 10 | rem
|
| 11 | rem Unless required by applicable law or agreed to in writing, software
|
| 12 | rem distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 | rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 | rem See the License for the specific language governing permissions and
|
| 15 | rem limitations under the License.
|
| 16 |
|
| 17 | rem ---------------------------------------------------------------------------
|
| 18 | rem Set CLASSPATH and Java options
|
| 19 | rem ---------------------------------------------------------------------------
|
| 20 |
|
| 21 | rem Make sure prerequisite environment variables are set
|
| 22 | if not "%JAVA_HOME%" == "" goto gotJdkHome
|
| 23 | if not "%JRE_HOME%" == "" goto gotJreHome
|
| 24 | echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
|
| 25 | echo At least one of these environment variable is needed to run this program
|
| 26 | goto exit
|
| 27 |
|
| 28 | :gotJreHome
|
| 29 | if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome
|
| 30 | if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome
|
| 31 | if not ""%1"" == ""debug"" goto okJavaHome
|
| 32 | echo JAVA_HOME should point to a JDK in order to run in debug mode.
|
| 33 | goto exit
|
| 34 |
|
| 35 | :gotJdkHome
|
| 36 | if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
|
| 37 | if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
|
| 38 | if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
|
| 39 | if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
|
| 40 | if not "%JRE_HOME%" == "" goto okJavaHome
|
| 41 | set "JRE_HOME=%JAVA_HOME%"
|
| 42 | goto okJavaHome
|
| 43 |
|
| 44 | :noJavaHome
|
| 45 | echo The JAVA_HOME environment variable is not defined correctly
|
| 46 | echo This environment variable is needed to run this program
|
| 47 | echo NB: JAVA_HOME should point to a JDK not a JRE
|
| 48 | goto exit
|
| 49 | :okJavaHome
|
| 50 |
|
| 51 | if not "%BASEDIR%" == "" goto gotBasedir
|
| 52 | echo The BASEDIR environment variable is not defined
|
| 53 | echo This environment variable is needed to run this program
|
| 54 | goto exit
|
| 55 | :gotBasedir
|
| 56 | if exist "%BASEDIR%\bin\setclasspath.bat" goto okBasedir
|
| 57 | echo The BASEDIR environment variable is not defined correctly
|
| 58 | echo This environment variable is needed to run this program
|
| 59 | goto exit
|
| 60 | :okBasedir
|
| 61 |
|
| 62 | rem Don't override the endorsed dir if the user has set it previously
|
| 63 | if not "%JAVA_ENDORSED_DIRS%" == "" goto gotEndorseddir
|
| 64 | rem Set the default -Djava.endorsed.dirs argument
|
| 65 | set "JAVA_ENDORSED_DIRS=%BASEDIR%\endorsed"
|
| 66 | :gotEndorseddir
|
| 67 |
|
| 68 | rem Set standard command for invoking Java.
|
| 69 | rem Note that NT requires a window name argument when using start.
|
| 70 | rem Also note the quoting as JAVA_HOME may contain spaces.
|
| 71 | set _RUNJAVA="%JRE_HOME%\bin\java"
|
| 72 | set _RUNJDB="%JAVA_HOME%\bin\jdb"
|
| 73 |
|
| 74 | goto end
|
| 75 |
|
| 76 | :exit
|
| 77 | exit /b 1
|
| 78 |
|
| 79 | :end
|
| 80 | exit /b 0
|