
ReferredProject has
referredProjectPackage/ReferenceClass.java
package referredProjectPackage;
public class ReferenceClass {
public void sayHello(){
System.out.println("Hello from the reference class.");
}
}
MainProject has
mainPackage/MainClass.java
package mainPackage;
import referredProjectPackage.*;
public class MainClass {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("MainClass works.");
ReferenceClass rc = new ReferenceClass();
rc.sayHello();
}
}
It gives error:

Right Click on the MainProject in the PackageExplorer. Select properties at the bottom. Properties for the MainProject window opens. Select JAVA build path and then select the Projects tab.