[英]Java - How do i call a class from a different project?
This is my Main class, im trying to call both the ScheduleData and ScheduleTime classes from a different project. 这是我的Main类,试图从另一个项目中调用ScheduleData和ScheduleTime类。
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 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. 您需要将项目B添加到项目A使用的运行配置中。在菜单运行->运行配置...中,将项目B添加到运行配置的“类路径”标签中。
see here calling a class in another project Eclipse 在这里看到在另一个项目Eclipse中调用类
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.