I have a Java Project
, for which I'm now creating a Web interface, using a Dynamic Web Project
from Eclipse. The Web project consists of a single servlet
and two JSP
's. Something like this:
/JavaApplication
/src
/lib
/resources
/WebApplication
/src
/Servlet.java
/WebContent
/WEB-INF
index.jsp
other.jsp
Now, I need to reference JavaApplication
from WebApplication
, in order to use its classes to process web requests. What's the best way to accomplish this ? My idea is to create a .jar
of the JavaApplication
, containing all the .class
files, /resources
, and /libs
. In this way, I could include the .jar in the web application, and I could have a single .war
file that contained the entire application.
What do you think? How is this problem typically solved ?
Note: I don't want to convert the Java Project into a Web project.
To access the Project References Properties page, right-click a PHP project in PHP Explorer view and select Properties | Resource -or- select the project and from the menu bar go to Project | Properties | Project References Properties .
In Eclipse project properties, add the project to the Java EE Module Dependencies (Eclipse 3.5 or older)
or Deployment Assembly (Eclipse 3.6 or newer) entry in the project properties.
This way Eclipse will take care about doing the right thing to create a WAR out of this all (it will end in /WEB-INF/lib
). No other configuration is necessary, even not some fiddling in Build Path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With