zkEnv.cmd 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. set ZOOCFGDIR=%~dp0%..\conf
  17. set ZOO_LOG_DIR=%~dp0%..\logs
  18. set ZOO_LOG4J_PROP=INFO,CONSOLE
  19. REM for sanity sake assume Java 1.6
  20. REM see: http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html
  21. REM add the zoocfg dir to classpath
  22. set CLASSPATH=%ZOOCFGDIR%
  23. REM make it work in the release
  24. SET CLASSPATH=%~dp0..\*;%~dp0..\lib\*;%CLASSPATH%
  25. REM make it work for developers
  26. SET CLASSPATH=%~dp0..\build\classes;%~dp0..\build\lib\*;%CLASSPATH%
  27. set ZOOCFG=%ZOOCFGDIR%\zoo.cfg
  28. @REM setup java environment variables
  29. if not defined JAVA_HOME (
  30. echo Error: JAVA_HOME is not set.
  31. goto :eof
  32. )
  33. set JAVA_HOME=%JAVA_HOME:"=%
  34. if not exist "%JAVA_HOME%"\bin\java.exe (
  35. echo Error: JAVA_HOME is incorrectly set: %JAVA_HOME%
  36. echo Expected to find java.exe here: %JAVA_HOME%\bin\java.exe
  37. goto :eof
  38. )
  39. REM strip off trailing \ from JAVA_HOME or java does not start
  40. if "%JAVA_HOME:~-1%" EQU "\" set "JAVA_HOME=%JAVA_HOME:~0,-1%"
  41. set JAVA="%JAVA_HOME%"\bin\java