Link to home
Start Free TrialLog in
Avatar of alexlindley
alexlindley

asked on

Build Path problem with Dynamic Web Project and Java Project in Eclipse (RAD v7)

I have a problem using Rational Application Developer v7 (eclipse v3...).

I have created a Dynamic Web Project and this contains relevent java, jsp, xml that I am developing, however I've also created a separate java project which contains a few generic classes that I would like to keep separate from the Web Project.

The problem I've got is that I can not get the web project to see the source in the java project when it is being run (i get the java.lang.NoClassDefFoundError). I've tried endless messing around with the build path for both projects and I cant get it to pick up the java files from the java project.

Could someone please give me a "dummies guide" on how to set this up correctly?
The source file in the web project is called 'JavaSource' and the classes are in 'WebContent\WEB-INF\classes'.

The only way I can get round this at the moment is to create a jar with the source in from the java project and drop it into the \lib\ folder containing the other jars which are on the build path. I would like it so I dont have to export the jar file everytime I make a change in the java project!

Thanks for the help...
Avatar of NHBFighter
NHBFighter

I am using Eclipse not RAD but in eclipse the way I associate stand alone java projects to a web app is:

Go to 'Configure Build Path' for the Web app.
You should see a screen with several tabs, one of which should be labeled "Projects".
Under the projects tab click the 'Add..' button.
This should bring up a screen allowing you to select other projects defined in the current workspace.
Select the project you want to add to the build path.

I'm not sure how RAD handles the deployment of the web app, I use MyEclipse and it provides options of how it will deploy the associated java  projects with the web app (IE it will deploy it has a jar file in the WEB-INF/lib directory or it will place the classes under the WEB-INF/classes directory).   Hopefully the first steps outlined above will help you.

Good Luck
Dave
Avatar of alexlindley

ASKER

I got as far as your instructions go but thats when I hit the problems.

I'm using Websphere v6.0 so maybe there is something like MyEclipse with options that I'm missing out because it just wont find the classes when it is being run, but it does compile OK!!

Does anyone have any experience with Websphere v6.0 and RAD 7?
I worked it out!

You have to go to the EAR project of your Dynamic Web Project and go to Properties>J2EE Module Dependencies and then select your java project from there.

Remove the old jar i put in there, recompile and it works!
Actually, I dont think that did work, still doesnt work when I'm running the Web project :(
I guess this should just be closed off, I still havent got it to work properly.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial