Note
1. Eclipse virtual machine configuration
Eclipse needs to run on JVM. It seems that a JRE will also be installed during myeclipse installation, and then it will be installed on this JRE during runtime. Eclipse is the same, but after eclipse is often started, you will be prompted to say that it needs to run on JDK, but now it runs on JRE. In this case, eclipse often does not respond to your operations, but is stuck. In this case, you need to configure the initialization startup parameters of Eclipse.
The eclipseinstallation directory is in the same directory as eclipse.exe and has an eclipse. ini file. open the file in the editor and configure it as follows:
-Startup
Plugins/org. Eclipse. Equinox. launcher_1.0.200.v20090520.jar
-VM
D:/tool/jdk6/bin/javaw.exe
Added the red part of the parameter, the virtual machine points to the local InstallationJDKIn javaw.exe, note thatSpaces are not allowed in the path.Therefore, do not use the installation path with spaces when installing JDK.
Many people install JDK, which is relatively lazy and uses the default program files. There are spaces and spaces in the path. There are many other disadvantages.
Ii. Server Configuration
The configuration server in eclipse is different from that in myeclipse.
Myeclipse configuration server, such as Tomcat, now has a tomcat 6 in D:/, so myeclipse directs the server to this D:/tomcat6. When we release the project, myeclipse will compress the project into a war package and copy it to D:/tomcat6/webapps as a folder. If you publish a file multiple times, it will be copied multiple times, and automatic updates are supported.
For eclipse, after the server is configured, it also points to D:/tomcat6. The difference is that it will create a servers folder under the work area, and put the configuration file of the server below, you can configure multiple servers without interfering with each other. When a project is released, the project content is not copied to the server to which it is directed, but put to a path under the work zone.
For example, the workspace is D: \ wspace.
Project name: mybatis
When the project is released to the server, such as Tomcat, the server. xml corresponding to Tomcat under the workspace/servers
Is automatically configured as follows:
<Context Path = "/mybatis" docbase = "mybatis"> </context>
In this way, when the server is started, it will find the files released by the project. Where can I find them? Here:
{Workspace} \. Metadata \. plugins \ org. Eclipse. WST. server. Core \Tmp0\ Wtpwebapps
Find mybatis, which is the docbase value. If the above server is the first configured server in the workspace,
That isTmp0If multiple servers are configured, these are tmp1, tmp2, and so on.
Eclipse is another way to configure the server:
When ecliipse configures the server, Runtime is usually configured first. For example, when Tomcat and eclipse Add a server, you need to specify its runtime. Therefore, you must configure the runtime first.
After Runtime is configured, you can configure multiple servers with one runtime. Multiple servers can be configured for one runtime. It is very easy to create a server based on the runtime, not to mention, the configuration is as follows:
You can also see the configuration file of the new server:
When you create a server, you also add a project, double-click the server [tomcat6-exerc] To Get The following configuration page:
You can configure the newly created server in detail. Under server locations, we recommend that you select use tomcat installation. At this time, the server path points to the Tomcat directory of runtime. In addition, in deploy path, you can specify the Tomcat webapps under runtime.
Usually, after a long time, there will be more and more projects on our computers. We generally do not release all our projects to the same tomcat, which is so messy and error-prone to startup for a long time. Sometimes, in order to solve this problem, we will copy many Tomcat and release different types of projects separately, so as to avoid confusion. However, more Tomcat resources occupy space.
The above method can solve these problems. We can only use a few Tomcat servers or even only one Tomcat server. However, when publishing, we can point to different directories. We can create a directory on the local disk to store published items. Manage the release according to the preceding deploy path.
3. Configure dynamic web project
In eclipse, if the project is not a dynamic web project and cannot be published to Tomcat, you must configure project facets.
Right-click the project properties, select the project facets menu, and tick the dynamic Web module on the right. "further configuration available" is displayed below, and click [configure context root and context directory, initial value:
Context root = project name
Context directory = webcontent
Generally, the value of context root is the project name. While context directory does not always happen to be the webcontent under the project directory, modify the value of context directory to the directory where the WEB-INF is located, such as Maven project, value: src/main/webapp, after saving, if the context directory value we fill in does not exist under the project root directory, it will generate such a directory for us, and there will be a new META-INF, WEB-INF/lib, WEB-INF/web under the directory. select XML.
After the configuration is complete, the project has the dynamic Web project feature and can be released to Tomcat.
After publishing, view server. xml:
Automatically added:
<Context docbase = "mybatis" Path = "/mybatis" reloadable = "true" Source = "org. Eclipse. JST. Jee. SERVER: mybatis"/>
View published items:
D: \ wspace \. Metadata \. plugins \ org. Eclipse. WST. server. Core \ tmp0 \ wtpwebapps \ mybatis
The current situation is that this directory is working in eclipse, and the directory location is a bit hidden. At this time, you can configure the server mentioned above. the docbase value of the <context> node in the XML file to point it to the absolute path of the project, as shown below:
<Context docbase = "D:/wspace/mybatis/webcontent" Path = "/mybatis" reloadable = "true" Source = "org. eclipse. JST. jee. server: mybatis "/>
This access is the same, but this configuration of the project still has certain requirements D:/wspace/mybatis/webcontent under the WEB-INF, there is lib and classes. The compiled class of the source file of the entire project must be put under this classes, and the lib directory must have enough jar packages to run the project. Of course, jar packages under WEB-INF/lib and jar packages under tomcat/lib cannot be repeated, otherwise an error is reported.