After the annoying integration of eclipse and tomcat, the problem of failing to automatically compile the Java file of the Tomcat project is finally solved.

Source: Internet
Author: User

 

Yesterday, I had a whimsy. I haven't read anything about struts for a long time, so I almost forgot about it. I plan to start picking it up. I know that four years ago, I published a book "proficient in struts". Haha, I have almost one hand and I have learned from Ling bookstore several times. Let's start with this book. I remember that when I learned this year, I ran through several examples in the book. While I ran through examples, I modified the sample code to better understand it. This is also the case. The problem is that we need to build the project first, so we can at least run through it. It is best to repair, modify, and modify the project above.

 

Just do what you say. Haha.

 

It was found that the environment was quite smooth, and the examples in the book were able to run, but one problem was that after the integration of eclipse and tomcat, since the examples in the book are created by creating a tomcat project-type project, after importing the example project on the (import) Cd, If you modify it, the Java file cannot be automatically compiled. However, java files in other Java projects on eclipse can be automatically compiled. No one on the internet can explain it. Forget it, or study it on your own. After an afternoon, the problem was finally solved. Haha.

 

In general, instead of creating a tomcat project, you can create a Java project because the Java project can be automatically compiled. However, you must manually import data one by one according to the directory structure on the CD. Of course, there are also many problems on the way,

If you cannot find the org. Apache. Struts. action package, configure it in the. classpath file;

If the file may be lost during import, manually copy the file (for example, the resource file );

If you need to manually create some file directories such as WEB-INF directory;

For example, change the original default. Class file output path to/WEB-INF/classes;

If you need to manually configure tomcat, right-click the project name (helloapp) and choose Properties> Tomcat option> check "is a tomcat Project". manually enter the context name, which is/helloapp, press the "OK" button to automatically generate D:/j2eeproject/tomcat 5.5/CONF/Catalina/localhost/helloapp. XML file.

If you need to manually import D:/j2eeproject/tomcat 5.5/common/lib/servlet-api.jar, jsp-api.jar, jasper-runtime.jar package

And so on.

 

To sum up, although it is relatively simple to create a tomcat project and then import the original directory file of the CD, it is not conducive to learning things. Although the Java project is created, then I learned a lot about solving the problem according to the error prompt.

 

Hey, this afternoon is really not in vain. Although I didn't go to bed as usual, I think it is worth the harvest. At least you can repair, modify, and modify the existing code, and you can view the running result immediately.

 

However, whatever project (Tomcat Project/Java project) is created, the classes folder and the. Class file below may not be displayed in eclipse. I don't know why. Pay attention to it later.

 

Haha, watch TV. , Just watch the news broadcast.

 

 

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.