欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決安裝tomcat時出現(xiàn)的問題

 更新時間:2024年02月19日 16:43:13   作者:qq_36443319  
這篇文章主要介紹了解決安裝tomcat時出現(xiàn)的問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教

在win10安裝了JDK8并配置好了相關路徑,在Tomcat在啟動過程中出現(xiàn)startup.bat時閃退。

找出問題的原因

右鍵編輯打開“startup.bat"文件,然后找文件的最后一行代碼是:end 在:end的后面輸入pause

如下圖所示:

接下來在DOS命令窗口運行startup.bat

此時提示報錯信息如下:

the JRE_HOME environment variable is not defined correctly This environment variabl

原因知道了,下面來看解決辦法

1、分析startup.bat啟動腳本:發(fā)現(xiàn)其調用了catalina.bat,而catalina.bat調用了setclasspath.bat

2、在setclasspath.bat的頭部定義了JAVA_HOME和JRE_HOME的值,那么這里需要我們手動設置JAVA_HOME變量和JRE_HOME變量(紅色代碼為新添加

注意:你所設置的變量要和自己的電腦中”環(huán)境變量“里的JAVA_HOME和JRE_HOME保持一致,我的是紅色的代碼。

第一還是配錯了路徑,是應為環(huán)境變量中JRE_HOME的問題。

錯把jre的絕對路徑放在JAVA_HOME中了。

把JAVA_HOME中的jre的絕對路徑刪除掉。

重新建一個JRE_HOME,并且加入jre的絕對路徑。

改完后就如下:

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the “License”); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
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.

rem ---------------------------------------------------------------------------
rem Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings
rem are valid and consistent with the selected start-up options and set up the
rem endorsed directory.
rem ---------------------------------------------------------------------------

set JAVA_HOME=D:\D:\tomcat\apache-tomcat-8.5.43

set JRE_HOME= C:\Program Files\Java\jre-9.0.4 

rem Make sure prerequisite environment variables are set

rem In debug mode we need a real JDK (JAVA_HOME)
if “”%1"" == ““debug”” goto needJavaHome

rem Otherwise either JRE or JDK are fine
if not “%JRE_HOME%” == “” goto gotJreHome
if not “%JAVA_HOME%” == “” goto gotJavaHome
echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
echo At least one of these environment variable is needed to run this program
goto exit

:needJavaHome
rem Check if we have a usable JDK
if “%JAVA_HOME%” == “” goto noJavaHome
if not exist “%JAVA_HOME%\bin\java.exe” goto noJavaHome
if not exist “%JAVA_HOME%\bin\javaw.exe” goto noJavaHome
if not exist “%JAVA_HOME%\bin\jdb.exe” goto noJavaHome
if not exist “%JAVA_HOME%\bin\javac.exe” goto noJavaHome
set “JRE_HOME=%JAVA_HOME%”
goto okJava

:noJavaHome
echo The JAVA_HOME environment variable is not defined correctly.
echo It is needed to run this program in debug mode.
echo NB: JAVA_HOME should point to a JDK not a JRE.
goto exit

:gotJavaHome
rem No JRE given, use JAVA_HOME as JRE_HOME
set “JRE_HOME=%JAVA_HOME%”

:gotJreHome
rem Check if we have a usable JRE
if not exist “%JRE_HOME%\bin\java.exe” goto noJreHome
if not exist “%JRE_HOME%\bin\javaw.exe” goto noJreHome
goto okJava

:noJreHome
rem Needed at least a JRE
echo The JRE_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto exit

:okJava
rem Don’t override the endorsed dir if the user has set it previously
if not “%JAVA_ENDORSED_DIRS%” == “” goto gotEndorseddir
rem Set the default -Djava.endorsed.dirs argument
set “JAVA_ENDORSED_DIRS=%CATALINA_HOME%\endorsed”
:gotEndorseddir

rem Don’t override _RUNJAVA if the user has set it previously
if not “%_RUNJAVA%” == “” goto gotRunJava
rem Set standard command for invoking Java.
rem Also note the quoting as JRE_HOME may contain spaces.
set _RUNJAVA="%JRE_HOME%\bin\java.exe"
:gotRunJava

rem Don’t override _RUNJDB if the user has set it previously
rem Also note the quoting as JAVA_HOME may contain spaces.
if not “%_RUNJDB%” == “” goto gotRunJdb
set _RUNJDB="%JAVA_HOME%\bin\jdb.exe"
:gotRunJdb

goto end

:exit
exit /b 1

:end
exit /b 0

添加變量后保存,并關閉文件,重新啟動tomcat,然后在點擊startup.bat,看到下面這樣就說明OK了

如果是啟動后再次啟動出現(xiàn)問題,可能是你沒有關閉之前啟動的,造成8080端口占

有兩種方案:

1.在startup.bat 同級目錄中,按 shutdown.bat 關閉 (建議用此方法)

2.Tomcat服務器的配置文件,全部都在tomcat的安裝目錄下conf目錄下:修改tomcat的端口為9090修改完server.xml文件必須重啟服務器才能有效。

通過瀏覽器的地址欄訪問測試:http://localhost:9090

總結

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

  • Tomcat并發(fā)優(yōu)化方法介紹

    Tomcat并發(fā)優(yōu)化方法介紹

    這篇文章主要介紹了Tomcat并發(fā)優(yōu)化方法介紹,小編覺得挺不錯的,這里給大家分享下,供需要的朋友參考。
    2017-10-10
  • 詳解windows 10中Tomcat安裝和部署的教程

    詳解windows 10中Tomcat安裝和部署的教程

    這篇文章主要介紹了windows 10中Tomcat安裝和部署教程,本文圖文并茂給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-11-11
  • Java開啟/關閉tomcat服務器的方法

    Java開啟/關閉tomcat服務器的方法

    這篇文章主要介紹了Java開啟/關閉tomcat服務器的方法,本文給大家介紹的非常詳細,具有一定的參考借鑒價值 ,需要的朋友可以參考下
    2019-06-06
  • tomcat配置虛擬路徑的實現(xiàn)步驟

    tomcat配置虛擬路徑的實現(xiàn)步驟

    本文主要介紹了tomcat配置虛擬路徑的實現(xiàn)步驟,主要是在localhost文件中進行配置,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2023-05-05
  • 簡單記錄Cent OS服務器配置JDK+Tomcat+MySQL

    簡單記錄Cent OS服務器配置JDK+Tomcat+MySQL

    這篇文章主要介紹了簡單記錄Cent OS服務器配置JDK+Tomcat+MySQL,需要的朋友可以參考下
    2014-12-12
  • 淺談Tomcat如何打破雙親委托機制

    淺談Tomcat如何打破雙親委托機制

    本文主要介紹了淺談Tomcat如何打破雙親委托機制,文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-07-07
  • 完美解決Tomcat關閉后報錯問題

    完美解決Tomcat關閉后報錯問題

    這篇文章主要介紹了完美解決Tomcat關閉后報錯問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-06-06
  • 詳述 tomcat 中的 server.xml 配置文件示例

    詳述 tomcat 中的 server.xml 配置文件示例

    本文將通過實例,介紹server.xml中各個組件的配置,并詳細說明 Tomcat 各個核心組件的作用以及各個組件之間的相互關系。對tomcat server.xml 配置文件相關知識感興趣的朋友一起看看吧
    2017-08-08
  • IDEA和Tomcat服務器的整合過程

    IDEA和Tomcat服務器的整合過程

    這篇文章主要介紹了IDEA和Tomcat服務器的整合,本文分步驟通過圖文并茂的形式給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-09-09
  • Tomcat啟動springboot項目war包報錯:啟動子級時出錯的問題

    Tomcat啟動springboot項目war包報錯:啟動子級時出錯的問題

    這篇文章主要介紹了Tomcat啟動springboot項目war包報錯:啟動子級時出錯的問題,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-08-08

最新評論