1

This is my Main class, im trying to call both the ScheduleData and ScheduleTime classes from a different project.

public main(String[] args) {
    ScheduleDate sd = new ScheduleDate();
    ScheduleTime st = new ScheduleTime();
    int testMonth = 2;
    int testDay = 2;
    int testYear = 2016;
    int testHour = 5;
    int testMinute = 30;
    String testPeriod = "PM";
    sd.setMonth(testMonth);
    sd.setDay(testDay);
    sd.setYear(testYear);
    st.setHour(testHour);
    st.setMinute(testMinute);
    st.setPeriod(testPeriod)
  • You need to export the project into a jar and tell your ide (if you are using one) to use the jar as a library jar – WIR3D Mar 06 '16 at 20:59
  • Depending on the IDE, you may be able to use the project itself as a library, without needing the step of exporting a Jar file. – markspace Mar 06 '16 at 21:01
  • if you're using Eclipse, `CTRL+MAJ+O` and choose the right classes to import – Yassin Hajaj Mar 06 '16 at 21:03

1 Answers1

0

You need to add project B to the Run configuration used by project A. In the menu Run -> Run configurations... , add the project B in the tab 'classpath' of your run configuration.

see here calling a class in another project Eclipse

Community
  • 1
  • 1
Noe
  • 56
  • 8