• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Configuring a Web project to reference a Java Project.

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created a Dynamic Web project in WSAD.
I need to create a java project that this references.
I set the Java Build Path properties of the Web Project to use my Java project. the files in my web project using the java files in my java project compiles.
Now I try to run the Web project - it complains of mising classes.
When I try to export my projecft as a war file the files in my java project are not exported as well.
What have I missed?
 
author
Posts: 4342
40
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
WSAD can set build time (class path) references as well as run time references (set in the \WebContent\META-INF\MANIFEST.MF file of the WAR or just META-INF\MANIFEST.MF of JARs).

You need the build time references to COMPILE and the run time references when the server is running and the WAR is deployed in order for the application to USE the specified external projects. The run-time reference is absolutely neccessary else the WAR will report class not found exceptions.

Run-time references to existing projects will not be exported when a WAR is exported. They will, however, exported if they both belong to an EAR and the EAR is exported (they will be separate but both inside the EAR). Else, the only way is to use the java project without exporting the EAR is to manually export the java project into a JAR file first, and then copy it into the WAR's WebContent\WEB-INF\lib directory, the down side being this is a manual step (unless you set up scripts) and will have to be repeated before you build a WAR.
[ November 14, 2005: Message edited by: Scott Selikoff ]
 
dhanya kairali
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the response. This was the solution I was looking for.
 
dhanya kairali
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have set up my Java project and my Web project.
I add my Java project to the build path of my web project
I open Manifest.MF and add the Java Project as a dependency for my Web project.
My ear projects application files says it has 2 modules -my Web project and my Java project.
In the Applications tab I set WAR Class loader policy to APPLICATION
Is this correct?
Also what do I need to do after I update a java file in my java project so that the change gets reflected? Do I need to do a project rebuild? Is there a better solution?
Thanks in advance!
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic