JavaWeb-tomcat安装(Unsupported major.minor version 51.0/startup.bat闪退)

JavaWeb-tomcat安装(Unsupported major.minor version 51.0)

 

一 启动startup.bat 出错i

今天安装tomcat出错,折腾了一下午,收获了许多,特此分享一下,同时也分享一下自己总结的方法

 

二 寻错方法

和我一样,大多数出现闪退的时候,百度一下大多数结果都是环境错误,我的环境虽然没有错,但也检查了很久,心很累

rem rem     http://www.apache.org/licenses/LICENSE-2.0 rem rem Unless required by applicable law or agreed to in writing, software rem 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 and rem limitations under the License.

if "%OS%" == "Windows_NT" setlocal rem --------------------------------------------------------------------------- rem Start script for the CATALINA Server rem ---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined set "CURRENT_DIR=%cd%" if not "%CATALINA_HOME%" == "" goto gotHome set "CATALINA_HOME=%CURRENT_DIR%" if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome cd .. set "CATALINA_HOME=%cd%" cd "%CURRENT_DIR%" :gotHome if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome echo The CATALINA_HOME environment variable is not defined correctly echo This environment variable is needed to run this program goto end :okHome

set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"

rem Check that target executable exists if exist "%EXECUTABLE%" goto okExec echo Cannot find "%EXECUTABLE%" echo This file is needed to run this program goto end :okExec

rem Get remaining unshifted command line arguments and save them in the set CMD_LINE_ARGS= :setArgs if ""%1""=="""" goto doneSetArgs set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 shift goto setArgs :doneSetArgs

call "%EXECUTABLE%" start %CMD_LINE_ARGS%   //将start改为run

:end

PAUSE    //末尾加上Pause

可以直接看到自己的错误的信息,进而进行处理

三 错误处理

JAVA_HOME 错误:环境变量错误

Unsupported major.minor version 51.0 错误:jdk版本和tomcat中的class文件版本不对应,解决方式jdk1.6对应tomcat6.xx,应该是一一对应

 

大家如果还有问题可以留言交流,与君共学!

 

posted @ 2017-05-01 21:53  JunQiu  阅读(888)  评论(1编辑  收藏  举报