zkEnv.cmd 1.7 KB

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