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