0

My project has the following directory structure:

Projects
|---------A
          |---B
          |---C

Project C uses src files of B. In eclipse I import project A and classpath file present under A contains B's and C's source folder as classpathentry src. Thus, even when I am on any of C's java file which uses variables declared in B's java file, I am able to navigate to them using Ctrl+Click on the variable.

Now my requirement is to move out C to the level of project A:

Projects
|--------A
         |---B

|--------C

Now A and C will have different classpath files. When in C's classpath file I try to give relative path of B's source folder. I get the following error in eclipse:

Illegal entry in '.classpath' of project 'B' file: Path for IClasspathEntry must be absolute

I tried out creating a jar of B's source file and giving the classpathentry of the jar in C's classpath file. But, with this approach , I loose out being able to navigate to B's java file from C's java file using Ctrl+click.

I cant give absolute path because the code is shared and different systems will have different path.

So, how do I specify my project C's dependency on B's source folder in .classpath file so that I retain the navigation through Ctrl+Click

Manas Saxena
  • 2,171
  • 6
  • 39
  • 58
  • Are you hacking the files manually instead of using the UI that *has* a way to establish dependencies between projects? – nitind Oct 25 '16 at 15:32
  • @nitind Can you help me how can this be achieved by UI? Do I have to configure something in BuildPath . How and where? – Manas Saxena Oct 25 '16 at 15:35
  • 1
    Yes, http://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.user/reference/ref-properties-build-path.htm?cp=1_4_3_1 – nitind Oct 25 '16 at 15:36
  • @nitind Okay , as stated in the link I tried linked source to my files , but even that does not accept relative path. It works with absolute path but as I stated in my question my code is shared hence cant be using absolute path as different systems may have different paths – Manas Saxena Oct 25 '16 at 16:11
  • Did the part of that page on **Projects tab** not provide a way to do this? – nitind Oct 25 '16 at 17:06
  • Okay got it working , your answer along with this one helped http://stackoverflow.com/questions/4000039/is-there-a-way-to-setup-linked-resources-relative-to-the-project-file – Manas Saxena Oct 26 '16 at 03:40

0 Answers0