Several projects with Eclipse

I have a workspace inside Eclipse in which there are 2 projects.

I want to refer to project # 2 from project # 1, but when I go to Project → Properties → References and mark the project that I want to add as a link, I still can’t create an instance of classes from project No. 2 inside project No. 1 .

This is a Blackberry app developed in Java and in Eclipse.

Project1 Launcher.java

Project2 Screen.java

I want to use Screen scr = new Screen(); // located in Project1 Screen scr = new Screen(); // located in Project1

+6
java eclipse blackberry
source share
1 answer

You need to add the project to the build path so that the Eclipse Java compiler can see another project.

  • Select Project-> Properties-> Java Build Path-> Project tab
  • Select Add ...
  • Add Project 1 and OK back to the workspace.

Another thing to check. If your classes are in the default package, they will not be imported. If so, try moving the classes to an explicit package.

For example:

 import mypackage.Screen; ... Screen scr = new Screen(); 
+8
source share

All Articles