0
创建在NetBeans IDE的项目6.9 在一个项目中,我有一个接口IBusinessLogic 在第二个项目中,我创建了一个类BusinessLogic它实现IBusinessLogic 在第三个项目我创建BusienssLogic的对象并将此对象分配给IBusinessLogic的引用。我没有得到任何错误而写,但是当 我清理并生成第三项目中,我得到异常,下面:干净构建失败在NetBeans
incompatible types found : com.abc.businesslogic.BusinessLogic required: com.abc.businesslogic.interfaces.IBusinessLogic com.abc.businesslogic.interfaces.IBusinessLogic logic = bl; Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error D:\ProjectsFeb12\Service\nbproject\build-impl.xml:531: The following error occurred while executing this line: D:\ProjectsFeb12\Service\nbproject\build-impl.xml:261: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 3 seconds)
当我知道我可以指定在超类型的基准子类型的对象,那么这异常必须是IDE。我该如何解决这个问题? 我把我的所有代码都移到了一个新项目中,但没有成功。
代码:
package com.abc.workerhandlers; import com.abc.businesslogic.BusinessLogic; import com.abc.businesslogic.interfaces.IBusinessLogic; public class MQ2MQWorker1 { MQ2MQWorker1(){} public void init(){ BusinessLogic bl = new BusinessLogic(); IBusinessLogic logic = bl; // This line is giving problem } }
当我运行它完美地执行该项目,但该项目的罐子在dist目录中没有创建。
你可以发布一段代码的错误所在出现? – 2012-03-27 06:21:51
您确定'com.abc.businesslogic.BusinessLogic'实现了'com.abc.businesslogic.interfaces.IBusinessLogic'吗? – 2012-03-27 06:21:53
@JimGarrison我确定。 – sjain 2012-03-27 06:30:15