When you start Tomcat, the cmd window flashes over the workaround.
Problem phenomenon:
In the actual development is generally eclipse+tomcat (may also use the Tomcat plug-in), we only need to click on the Servers button on the eclipse can successfully start Tomcat,
But if you want to double-click the Startup.bat startup in the Tomcat installation directory, it flashes. This is why (Tomcat failed to start), and immediately take a look at the specific reasons.
Let me first confirm with you the prerequisites for the problem (native version java:1.6.20,tomcat:6.0.32):
1 It is normal to start Tomcat inside Eclipse.
2 The various environment variables are configured in the system as follows:
Java_home:h:\developtools\java\jdk1.6.0_20
catalina_base:h:\developtools\apache-tomcat-6.0.32
catalina_home:h:\developtools\apache-tomcat-6.0.32
CLASSPATH:.; %java_home%;%java_home%\jre\lib;
PATH:.; %java_home%\bin;%catalina_home%\bin;
To analyze:
Enter Tomcat's installation directory (that is, where it is placed after decompression):
See the circled Red 3-bat file, typically launched Tomcat via Startup.bat process is: Startup->catalina->setclasspath->catalina
If one of the 3 bat files has an error, it fails to start up. In order to find the reason for the flash, we need to see what's going on in these 3 files.
First Notepad to open the Startup.bat, find the Last word:: End, we know the meaning of ending means,: Ends is a mark, we add a sentence after the pause
(Pause the meaning of waiting) to perform startup.bat again, you will see the above figure, when we press any key when the cmd window is flashing. But it has been established that our environment variables are correct.
To see the information in more detail, let's change the phrase: Find the call "%executable%" start%cmd_line_args% replace the inside start with run.
Then look at the CMD window output error message:
Error occurred during initialization of VM
Could not reserve enough spaces for objectheap
Could not create the Java virtual machine
We can generally understand that: because the program does not request enough memory to start the VM, causing the program to exit.
So we can solve this problem: apply enough memory to get it.
Following: Found in the Catalina.bat under execute the requested command
The set java_opts replaces this sentence with the following:
Set java_opts=%java_opts%-server-xms800m-xmx800m-xx:maxnewsize=256m
Start again Startup.bat will see
Has started successfully (remember to change the contents of the previously modified run, pause back).
Here, it seems that the problem has been solved, if you encounter other problems how to solve it (because other problems will lead to the CMD window flashed).