各种范型的报错:
1、Syntax error,parameterized types are only available if source level is 1.5
总是报错,提示Syntax error,parameterized types are only available if source level is 5.0
原因是:我们的项目编译的时候使用的jdk版本低于5.0
解决方法如下:
在Myeclipse IDE中的菜单Window/Preferences/Java/Compiler里改为1.6
或者在单个项目里设置了source level 为5.0以上以下(在项目属性/Java Compiler 里改为5.0或高于5.0)
这是因为@Override的方式适用于jdk1.7之前的Runnable接口:
JDK1.8中将Runnable标记为@FunctionalInterface函数式编程接口:
解决方法:同上
3、Example7中:import org.apache.commons.math3.linear.Array2DRowRealMatrix;出错
这是因为cloudsim3.0.3开始不在使用flanagan.jar而是用math3库来进行科学计算。原文:
- Removed the dependency on the flanagan library. It is now replaced with Apache Math. The implementation and interface of the MathUtil has been changed accordingly
解决方案:下载math3库(http://commons.apache.org/proper/commons-math/download_math.cgi)并add external jar。