1

I've created a new project in java using eclipse.

I've tried reference a project from the workspace to it - but when I try to write code using the referenced project interface it won't accept it. Tried to jar the project and reference the jar - won't work.

Another project - that I received with the project I try to reference - came already referenced and it works ok there.

I did a simple reference using build path. Tried clean but it didn't help. I'm on auto build. Strange thing - eclipse won't recognize the attempt of using code from the referenced project - but if I press F3 on it - it will open the right source file.

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
user1433927
  • 161
  • 2
  • 14

2 Answers2

0

Check whether the workspace on which works has write permission in your file system or not.

In case of jar archive make sure you have added that jar file in your class path using 'java buildpath'. If you have added that reference to your project then it will definitely work.

If an already referenced project works then according to me you have problem of access rights. You may not have permission to write/append your .classpath file.

Hope you have performed below steps to add project reference.

Right click project -> Build path -> Configure buildpath... -> Project tab -> Add... -> Then add project from current workspace

Parth Bhagat
  • 509
  • 1
  • 11
  • 24
  • I already tried what you suggested - it still not working. How to check for the permissions? – user1433927 Sep 14 '14 at 05:41
  • Right click on your workspace directory and make sure it is not "Read Only" in case of windows and has "Read and Write" permission for user in case of *nix. I think if you have used a workspace created by some other user and directly pointed it to your Eclipse then this issue may occur. – Parth Bhagat Sep 15 '14 at 06:45
0

Years later, on Eclipse Version: 2022-03 (4.23.0) I've also had issues linking source code of dependent maven module projects. I found parth's answer got me started but there's a few more details.

Right click the parent project and select Build path -> Configure buildpath...

  • on "Project" tab - use the Add button to add the eclipse project
  • on "Order and Export" tab - use the Up button to move the eclipse project higher than the JRE System Library and Maven Dependencies

Upon returning to the code in the parent project and hitting F3 on a class name from the child project, eclipse will now bring me to the child project source code.

Paul Cuddihy
  • 477
  • 6
  • 12