开发者

eclipse tomcat: take the classpath from the project

I have a java web project in eclipse and want to define a tomcat server. It seems that in the tomcat server I must define again my classpath. How can I tell tomcat to just use the classpath from my project (shouldn't this be obvious?).

Unfortunately my jars are scattered all around and it is an headache to add them one by one to my tomcat configura开发者_Go百科tion and maintain this.


Here you go :

Run -> Run Configurations... -> Classpath


You don't have to tell tomcat to look for jars scattered all around the places. This can be easily taken care by eclipse. Configure your eclipse build path properly. Create Libraries (in eclipse) and group jar together. Try to export the war and check if eclipse is packaging all the required jars in WEB-INF/lib.


No, Tomcat and web apps have a pretty well-defined CLASSPATH. You shouldn't have to specify anything if you package your app properly:

  1. All the packages and .class files in WEB-INF/classes are in CLASSPATH.
  2. So are all the JARs in WEB-INF/lib

You should figure out how to put your JARs in the right place - that's WEB-INF/lib of your WAR file. Maybe Ant or Maven can help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜