In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Today, the editor will share with you the relevant knowledge points of tomcat-related configuration and eclipse integration methods. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.
Integration of tomcat related configuration and eclipse
Tomcat is a popular open source and free web application server. First of all, it should be clear that tomcat is closely related to java, so install jdk and set the environment variable of jdk before installation. Since jdk is already installed on the machine and jdk environment variable is set, I will not describe it too much here, but only the environment variables I have set:
Java_home:f:\ jdk_kit
Classpath:.;%java_home%\ lib\ dt.jar;%java_home%\ lib\ tools.jar; (there is a dot at the front)
Add:;% java_home%\ bin; at the beginning of the path (with a semicolon before and after it)
Enter java-version in the cmd window to see if the environment variable is set successfully:
My jdk version is 1. 8. 0: 45.
Well, this configures the environment variables for jdk. Let's start with tomcat.
First of all, Baidu searches for tomcat and downloads it from the official website of apache. The latest version of tomcat8 is selected here.
After clicking in, I choose the zip format, that is, the installation-free version. Since my machine is 64-bit windows, I choose the following:
After downloading, extract it to my custom tomcat_8.0.24 folder under f disk:
After you unzip it, you need to configure the environment variables and some settings for tomcat:
Create a new tomcat_home in the environment variable, and the value is the directory where tomcat is located, that is, f:\ tomcat_8.0.24
In addition, create catalina_home and catalina_base, where catalina_home is the installation directory of tomcat, and catalina_base is the working directory of tomcat
I don't distinguish between them for the time being, so they all set their values to% tomcat_home%
After configuring the environment variables for tomcat, we need to configure some files in tomcat:
Open the bin folder under the tomcat installation directory to supplement startup.bat and shutdown.bat
Edit the two files and add the following two lines before the first line at the beginning of the file, @ echooff:
Setjava_home=jdk directory
The directory of the decompressed tomcat of setcatalina_home=
For my system, it is configured to:
Setjava_home=f:\ jdk_kit
Setcatalina_home=f:\ tomcat_8.0.24
After completing this step, you can click startup.bat to start the server and click shutdown.bat to shut down the server. Of course, this is just one of the ways.
Several ways to start and shut down tomcat will be described later.
Next, you should add tomcat to the service.
For the zip version downloaded from the Internet, you need to add tomcat to the service, otherwise you will not be able to configure tomcat or open the tomcat8w.exe program in the bin folder.
As you can see from the task manager, click the star button on the tomcat8w.exe program to start tomcat8.exe.
The way to add tomcat to the service is to navigate to the directory where the bin folder is located in cmd, and enter service.batinstall
Then you will see a series of environment variables just configured, and prompt that tomcat has been installed:
Note: each line here should clearly show the value set by each environment variable. If any parameter has no value and only double quotation marks are displayed, it will be an error.
In this case, although tomcat8w.exe can be opened, clicking the start button does not start the service (that is, it cannot be switched to a state where the stop button can be pressed).
You can also type services.msc to call up the service through cmd to see if there is apachetomcat8 (the default is manual startup. If you start automatically instead, the boot tomcat will start in the background)
So far, the basic configuration has been completed, and there may be some minor configurations, such as setting the user name and password of tomcat, which we will talk about later.
Startup of tomcat
After configuring tomcat, we are concerned about whether these configurations are successful or not, so we need to start tomcat to verify that tomcat can be started in several ways:
The first one: (not recommended)
This method can only be enabled by your own computer (suitable for your own computer to test web applications), other computers can not connect to their own computer's tomcat server, after many verification.
Start in the command console cmd and enter the following statement in cmd to turn the tomcat server on or off:
Netstart service name
Netstop service name
The service names of tomcat are all tomcat+ version numbers, such as tomcat6,tomcat7. Because my tomcat version is tomcat8, the service name here is tomcat8
The startup of this way in the Task Manager shows:
The latter two methods are shown as follows:
Therefore, it also reflects the anomaly of this way from the side door, so it is not recommended! Not recommended! Not recommended!
Second: use the batch file startup.bat to open the tomcat server, and use the shutdown.bat batch to shut down the tomcat server. For this way, join the
Two sentences setjava_home=jdk directory and setcatalina_home= decompressed tomcat directory
Third: go to the bin folder in the tomcat directory, open the tomcat7w.exe program, select the star button in the open window to open the server, and select the stop button to shut down the server.
Verification of tomcat
Knowing how to open tomcat, we can verify that tomcat is working, and choose any way to start tomcat, such as typing netstarttomcat8 in cmd
Prompt that the tomcat server starts successfully, then open a browser and type localhost:8080
If tomcat works and you can open the tomcat website, make sure that tomcat is working properly:
After the test, don't forget to turn off the server and turn it off in the way you choose to turn it on:
Finally, here are a few small things:
1.tomcat can set the user name and password. In the conf directory in the tomcat directory, there is a tomcat-users.xml file. Click in to edit the user name and password.
Add a line above / tomcat-users on the last line:
Userusername= "admin" password= "123456" roles= "manager-gui" /
You can set the user name and password to admin and 123456
Here is a little bit of knowledge. The role of role determines whether you are an administrator of tomcat. If you are an administrator, you can manage tomcat, such as deploying web references.
The default port number of 2.tomcat is 8080. You can open server.xml under the conf directory in the tomcat directory and find this line:
You can see that the port number is 8080, which can be changed to any port number.
This is all the process of tomcat downloading to configuration, and finally starting and verifying. If you want to develop with eclipse and tomcat, you also need to configure tomcat in eclipse.
First start eclipse, click [window], select the last [preferences], open the preferences window, click [server], and select the last [runtimeenviroments] of its children.
Click the [add] button in the window to add the server:
Select the configured tomcat server:
Set up the directory where tomcat is located and the jre used:
This completes the association between eclipse and tomcat, but the tomcat server has not yet been created.
To create a tomcat server, click the "servers" tab on the toolbar where the console is located under eclipse, and you will be prompted as follows:
Then we click according to the prompt, and the following window pops up:
Eclipse automatically selects the "tomcatv8.0server" option for us. Since we don't have resources yet, click "finish" to see the "servers" tag:
After the tomcat server is created, you also need to configure the tomcat server. Double-click the server created under the "servers" tab, and you will pop up the "overview" window of the server, find the "serverlocations" configuration option, and select the "usetomcatinstallation" option, so that the following "serverpath" will be automatically set to the installation directory of the tomcat server, and then manually set [deploypath] to webapps, thus completing all the configuration of the tomcat server in the eclipse:
We can click the green button, which is to start the server, and we will see that the server status under the [servers] tab has changed to start, and the end button is also activated:
At the same time, click the [console] tab, we can also see some information:
Indicates that tomcat has been started successfully in eclipse, then open a browser and type localhost:8080:
At this point, you can see that the tomcat server is working:
This shows that tomcat has been successfully configured in eclipse and is working properly.
Postscript
Some of the problems that will arise:
From the previous double-click on the server to open the [overview] window, you can see that some ports can be set in the right part of the interface, including tomcat port, http port and ajp port.
1. It is sometimes prompted that the port is occupied, probably because other software is occupied by one of these three ports (this is the most likely reason, most likely by the javaw process).
Then just shut it down forcibly.
These are all the contents of the article "how to integrate tomcat-related configuration and eclipse". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.