flybywire
flybywire

Reputation: 273552

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 configuration and maintain this.

Upvotes: 0

Views: 9064

Answers (3)

Mehdi LAMRANI
Mehdi LAMRANI

Reputation: 11597

Here you go :

Run -> Run Configurations... -> Classpath

Upvotes: 2

kdabir
kdabir

Reputation: 9868

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.

Upvotes: 1

duffymo
duffymo

Reputation: 308763

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.

Upvotes: 0

Related Questions