I've read the first part of the py4j.org introduction, then I skipped down to the Eclipse section. I installed the Eclipse plugins found here: http://eclipse.py4j.org/ and restarted Eclipse afterwards.
I have a class in the pre-existing Java project known as DateRange, so I created a new class called DateRangeEntryPoint, per the instructions. This consisted of the following code.
package statresearch.programs.DaypartParser;
import statresearch.programs.util.DateRange;
import py4j.GatewayServer;
public class DateRangeEntryPoint {
private DateRange dateRange;
public DateRangeEntryPoint(String startDate, String endDate, boolean includeStart, boolean includeEnd) {
dateRange = new DateRange(startDate, endDate, includeStart, includeEnd);
}
public DateRange getDateRange() {
return dateRange;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
GatewayServer gatewayServer = new GatewayServer(new DateRangeEntryPoint());
gatewayServer.start();
System.out.println("Gateway Server Started");
}
}
But, when I try to run this in eclipse, I get the following error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
GatewayServer cannot be resolved to a type
GatewayServer cannot be resolved to a type
The constructor DateRangeEntryPoint() is undefined at statresearch.programs.DaypartParser.DateRangeEntryPoint.main(DateRangeEntryPoint.java:22)
What I am stuck on is how to import py4j in Eclipse so that I can utilize, in Python, the objects already defined in a Eclipse project.