Java 当我点击 tomcat7.exe 时,我的 tomcat 没有运行它只是打开和关闭

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22782819/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 17:50:48  来源:igfitidea点击:

my tomcat is not running it just open and close when i click on tomcat7.exe

javatomcat

提问by srikanth

i am installing tomcat 7 in my PC it works in eclipse but when am try to open in bin/ tomcat7 . ex it just open and close ,(i am stop the server in eclipse) also ,in eclipse am trying to open admin console like URL: (localhost:1234/admin) it showing 404 error can any body knows this problem please help me..

我正在我的 PC 上安装 tomcat 7 它在 eclipse 中工作,但是当我尝试在 bin/tomcat7 中打开时。例如,它只是打开和关闭,(我在 eclipse 中停止服务器)也在 eclipse 中尝试打开管理控制台,如 URL: (localhost:1234/admin) 它显示 404 错误,任何人都知道这个问题,请帮助我。 .

回答by Sagar Jadhav

Just download the tomcat 32-bit/64-bit Windows Service Installer (pgp, md5) as in this set up is given which will install tomcat on your PC and you can also start and stop tomcat using the tomcat service.

只需下载 tomcat 32 位/64 位 Windows 服务安装程序 (pgp, md5),如本设置所示,它将在您的 PC 上安装 tomcat,您还可以使用 tomcat 服务启动和停止 tomcat。

回答by jwenting

You don't start Tomcat by double clicking the exe, use the batch files instead.
startup.bat starts the server, shutdown.bat stops it again.
And ignore the advise to get the service installer. You don't need those unless you want the server to start on system boot and run in the background. Which you don't want unless you're going to configure a production server, which you aren't here.
The batch files are in the same directory on your computer as the exe.

您不是通过双击 exe 来启动 Tomcat,而是使用批处理文件。
startup.bat 启动服务器,shutdown.bat 再次停止它。
并忽略获取服务安装程序的建议。除非您希望服务器在系统引导时启动并在后台运行,否则您不需要这些。除非您要配置生产服务器,否则您不希望这样做,而您不在这里。
批处理文件与 exe 位于计算机上的同一目录中。

回答by Haritha

If you are using Windows, you can follow the following to run tomcat7.exe:

如果您使用的是 Windows,则可以按照以下步骤运行tomcat7.exe

  1. Open your Command prompt (cmd)
  2. Set your JAVA_HOMEor JRE_HOME. Eg. set JRE_HOME=C:\Program Files\Java\jre7
  3. Go to the directory of your tomcat. Eg. cd C:\Program Files\apache-tomcat-7.0.35\bin
  4. Run startup.batfile. Eg. startup.
  1. 打开命令提示符 ( cmd)
  2. 设置您的JAVA_HOMEJRE_HOME。例如。set JRE_HOME=C:\Program Files\Java\jre7
  3. 转到您的 tomcat 的目录。例如。cd C:\Program Files\apache-tomcat-7.0.35\bin
  4. 运行startup.bat文件。例如。startup.

This should start your tomcat server without using Eclipse.

这应该会在不使用 Eclipse 的情况下启动您的 tomcat 服务器。

回答by krish legacy

To start your application server in windows :

要在 Windows 中启动您的应用程序服务器:

  1. Open command prompt .(Run as Administrator).
  2. Go to the path (..\apache-tomcat-8.0.27\bin) and run startup.bat
  3. A new command prompt opens up and should stay unclosed to tell your server is in running state.
  1. 打开命令提示符。(以管理员身份运行)。
  2. 转到路径 ( ..\apache-tomcat-8.0.27\bin) 并运行startup.bat
  3. 一个新的命令提示符会打开并且应该保持未关闭状态,以告诉您的服务器处于运行状态。

If command prompt opens and closes automatically, then the reason can be as below.

如果命令提示符自动打开和关闭,则原因可能如下。

  1. tomcat is already in started state in Eclipse.
  2. Check the connector port configured in server.xmlfile and check if that port is free in your local machine. [netstatcommand]
  3. Change the connector port to some unused port, preferably in 80XXseries.
  1. tomcat 在 Eclipse 中已经处于启动状态。
  2. 检查server.xml文件中配置的连接器端口,并检查该端口在您的本地机器上是否空闲。[netstat命令]
  3. 将连接器端口更改为某个未使用的端口,最好是80XX串联。

Let me know if you are able to invoke localhost:(the http connector port)you have configured in server.xmlthrough you web browser.

让我知道您是否能够调用localhost:(the http connector port)您已server.xml通过 Web 浏览器配置的内容。

Cheers.

干杯。

回答by Nikolay Frick

In my experience tomcat7 might not like it if JAVA_PATH or JDK_PATH contain bracket symbols like in "Program Files (x86)". Make sure you format path in your environmental variables correctly or move your JDK to another folder.

根据我的经验,如果 JAVA_PATH 或 JDK_PATH 包含“Program Files (x86)”中的括号符号,tomcat7 可能不喜欢它。确保正确格式化环境变量中的路径或将 JDK 移动到另一个文件夹。

回答by taufeeque alam

you have to set JAVA_HOME and JRE_HOME in System environment.while setting the JAVA_HOME and JRE_HOME, you should assure that JRE path that you are setting is corresponding to the JDK whose path you have set in JAVA_HOME. some time what happens that there may be more than one JDK in the system so conflict occurs. better to have only one JDK and corresponding JRE.

在系统环境中必须设置JAVA_HOME和JRE_HOME。设置JAVA_HOME和JRE_HOME时,要保证你设置的JRE路径与你在JAVA_HOME中设置的JDK路径相对应。有时会发生系统中可能有多个 JDK 从而发生冲突的情况。最好只有一个 JDK 和相应的 JRE。

回答by Rohit Singh

the JAVA_HOME and JRE_HOME environment variables set should not have semicolon or ; at the end...I was facing similar problem...removed semi-colon or ; from the end and tomcat server started from cmd screen after running startup command(of tomcat..bin folder).

JAVA_HOME 和 JRE_HOME 环境变量集不应有分号或;最后......我面临着类似的问题......删除了分号或; 在运行启动命令(tomcat..bin 文件夹)后,从最后和 tomcat 服务器从 cmd 屏幕启动。

回答by Vasudev

In my case, I had some reference to a jar file in catilana.bat, but the jar I had removed from my system. Tomcat started successfully once I removed that reference from catilana.bat

就我而言,我在 catilana.bat 中有一些对 jar 文件的引用,但我已从系统中删除了该 jar。从 catilana.bat 中删除该引用后,Tomcat 成功启动

回答by Venki WAR

First Set JAVA_HOMEand CLASSPathpath

首先设置JAVA_HOMECLASSPath路径

For Windows Java Path Settings

对于 Windows Java 路径设置

  1. Right click on Computerand open Properties.

  2. In Windows Vista or Windows 7, go to Advanced System Settings. Else go to next step. Go to Advanced Taband click on Environment Variablesbutton.

  1. 右键单击“计算机”并打开“属性”

  2. 在 Windows Vista 或 Windows 7 中,转至高级系统设置。否则进入下一步。转到高级选项卡并单击环境变量按钮。

enter image description here

在此处输入图片说明

  1. Select CLASSPathunder the list of System Variables, and press Edit and add If CLASSPath not available there click New button add C:\Program Files\java\jre 1.x.x_xx\binafter a semicolon.
  1. System Variables列表下选择CLASSPath,然后按 Edit 并添加如果 CLASSPath 不可用,则单击 New 按钮 在分号后添加 C:\Program Files\java\jre 1.x.x_xx\bin

enter image description here

在此处输入图片说明

  1. Now click on New' button under system variables and enter JAVA_HOME as variable name and path to jdk home directory (ex. C:\Program Files\Java\jdk1.x.x_xx
  1. 现在单击系统变量下的“新建”按钮并输入 JAVA_HOME 作为变量名和 jdk 主目录的路径(例如 C:\Program Files\Java\jdk1.x.x_xx

enter image description here

在此处输入图片说明

After Completing Java Path Settings

完成Java路径设置后



  • Go to the directory of your Tomcat. Eg. cd C:\Program Files\apache-tomcat-7.0.35\bin
  • Run startup.bat file enter image description here
  • 转到 Tomcat 的目录。例如。cd C:\Program Files\apache-tomcat-7.0.35\bin
  • 运行startup.bat文件 在此处输入图片说明

回答by Yannick

This is probably due to a bad setup of an environment variable.

这可能是由于环境变量设置不当造成的。

For example, if you setup incorrect JAVA_OPTS, tomcat startup will fail.

例如,如果设置不正确JAVA_OPTS,tomcat 启动将失败。

You can check your configuration by calling : catalina configtest

您可以通过调用来检查您的配置: catalina configtest

Here an example of the output for bad setup of JAVA_OPTS:

这是错误设置的输出示例JAVA_OPTS

Error occurred during initialization of VM Could not reserve enough space for object heap

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

虚拟机初始化期间发生错误无法为对象堆保留足够的空间

错误:无法创建 Java 虚拟机。

错误:发生了致命异常。程序将会退出。