zkEnv.cmd
@echo offREM Licensed to the Apache Software Foundation (ASF) under one or moreREM contributor license agreements. See the NOTICE file distributed withREM this work for additional information regarding copyright ownership.REM The ASF licenses this file to You under the Apache License, Version 2.0REM (the "License"); you may not use this file except in compliance withREM the License. You may obtain a copy of the License atREMREM http://www.apache.org/licenses/LICENSE-2.0REMREM Unless required by applicable law or agreed to in writing, softwareREM distributed under the License is distributed on an "AS IS" BASIS,REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.REM See the License for the specific language governing permissions andREM limitations under the License.set ZOOCFGDIR=%~dp0%..\confset ZOO_LOG_DIR=%~dp0%..set ZOO_LOG4J_PROP=INFO,CONSOLEREM for sanity sake assume Java 1.6REM see: http://java.sun.com/javase/6/docs/technotes/tools/windows/java.htmlREM add the zoocfg dir to classpathset CLASSPATH=%ZOOCFGDIR%REM make it work in the releaseSET CLASSPATH=%~dp0..\*;%~dp0..\lib\*;%CLASSPATH%REM make it work for developersSET CLASSPATH=%~dp0..\build\classes;%~dp0..\build\lib\*;%CLASSPATH%set ZOOCFG=%ZOOCFGDIR%\zoo.cfg@REM setup java environment variablesif not defined JAVA_HOME ( echo Error: JAVA_HOME is not set. goto :eof) --下面的语句会报错,因为%JAVA_HOME%这个的Path的路径是有空格的,所以会报错。--------correct--:>"%JAVA_HOME%\bin\java.exe"
if not exist %JAVA_HOME%\bin\java.exe ( echo Error: JAVA_HOME is incorrectly set. goto :eof ) set JAVA=%JAVA_HOME%\bin\java
zkServer.cmd
@echo offREM Licensed to the Apache Software Foundation (ASF) under one or moreREM contributor license agreements. See the NOTICE file distributed withREM this work for additional information regarding copyright ownership.REM The ASF licenses this file to You under the Apache License, Version 2.0REM (the "License"); you may not use this file except in compliance withREM the License. You may obtain a copy of the License atREMREM http://www.apache.org/licenses/LICENSE-2.0REMREM Unless required by applicable law or agreed to in writing, softwareREM distributed under the License is distributed on an "AS IS" BASIS,REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.REM See the License for the specific language governing permissions andREM limitations under the License.setlocalcall "%~dp0zkEnv.cmd"set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMainecho on # %JAVA%-------->"%JAVA%"call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*PAUSEendlocal