Eclipse Reference Features--references between projects

Source: Internet
Author: User

I ' m sorry, I forgot this article where I found. That's it is referenced.

In the past, I have studied the issue of Web project referencing Java project in Eclipse, and did not solve it, especially in-depth study.
Ideas and practices are as follows:
There is a project reference setting in the project properties in 1.Elcipse, which indicates that there is a reference projects setting in the Java Builder path.
Experiment: Build two Java Project A, b,b reference A, set B's Java Builder path/projects to reference Project A, then class in B can invoke Class A, compile and run through.
Demonstrates that eclipse has a good solution for Java project.
(Project reference settings do not know what is useful)
2.Web applications, using Eclipse WTP
According to the experiment settings above, (here the B project is a Web project), the compilation can pass, but the runtime cannot find the class in the A project.
There is no corresponding solution found.
3.Web applications, using Sysdeo Tomcat Plugin
Found this window/preferences/tomcat/advanced/add Java Projects to Tomcat classpath settings, set the Java project to the Tomcat Classpath, which is global to Tomcat, There are some inflexible, and other flaws, such as classloader that load these classes will be systemclassloader instead of WebappClassLoader, which will affect the loading of some resource files.
In addition, I experimented with this setting on the Tomcat5.5.17, and the result was an error starting Tomcat.

Read the Sysdeo document, it introduced the DevLoader to solve this problem specifically. Looked at his source code, very simple, a total of only 200 lines, the basic logic is to read the Eclipse project under the. #webclasspath,. classpath file to obtain the referenced Java classpath, by
DevLoader loads the classes outside of these projects.
The specific actions are:
1) Set the Java Builder Path;
2) Extract the Devloader.zip under Sysdeo plugin to the Tomcat directory/server/classes, in Tomcat Project/project Properties/tomcat/devloader Select the active DevLoader and the classpath in the list that are outside the item.
Refer to the readmedevloader.html of Sysdeo plugin.

This solves the problem by modifying the code in Project A, b, and immediately seeing the modified effect in the browser without having to restart Tomcat.


==========================================

Sysdeo Eclipse Tomcat Launcher plugin is a plug-in that is often used in the development of the Java EE to launch Tomcat in Eclipse and bind the Tomcat process to the Eclipse Java debugger So that you can perform some debug operations at run time, and when you modify or add or delete some Java files, the Tomcat context automatically re-load so that you don't have to restart Tomcat every time you make a change.

In the use of this plugin, often many people will encounter such an exception: ClassNotFoundException: Org.apache.catalina.loader.DevLoader, many people solve the solution is often to disable the DevLoader function. In fact DevLoader provides the functionality is very useful, it implements and expands the Webapploader. We know that by default we need to put classes and jar files under the web-inf/classes and Web-inf/lib of the Web application, but in the actual development environment, it is often necessary to refer to external classes and jar files, For example in another project classes, this time if there is no DevLoader, we need to copy these classes and jar files to the appropriate directory under the Web-inf of the Web application, and if DevLoader is enabled, Without the above restrictions, you can load classes and jars from all classpath used in the project.

Ways to enable DevLoader:

Check Activate DevLoader
Select the class library you want to load
Locate the file Devloader.zip in the plug-in package and unzip it to tomcat/server/classes.

http://sam9901.iteye.com/blog/114746

Eclipse Reference Features--references between projects

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.