How do I load a Ressource Path in multi-projects in proper project?

Tags: , ,



I have to use this project configuration:

Project 1
+ src
+ Model
  + Datamodel.dtd
Project 2
+ src

Project 1 does some work with xml and should load the dtd from the folder “Model”. I put this folder in the classpath of project 1. Project 1 is in the classpath of project 2. In project 2, I call a class from project 1 which try to load “Datamodel.dtd”. However, the path of my ressources points to the basepath of project 1 and not to project 2. Therefore it throws a “FileNotFoundException”.

Any Ideas how to solve that?

Answer

Only exported classpath entries are visible in dependent projects:

  1. Select project 1
  2. Go to Project > Properties tab Order and Export
  3. Check the checkbox of the Model classpath entry


Source: stackoverflow