Cloudsim3.0.3导入Eclipse各种错误解决方案

各种范型的报错:

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)


2、Example7中:The method run() of type new Runnable(){} must override a superclass method

这是因为@Override的方式适用于jdk1.7之前的Runnable接口:

JDK1.8中将Runnable标记为@FunctionalInterface函数式编程接口:

// Java 8之前:
    new Thread(new Runnable() {
        @Override
        public void run() {
            System.out.println("Before Java8, too much code for too little to do");
        }
    }).start();
//Java 8方式:
    new Thread( () -> System.out.println("In Java8, Lambda expression rocks !!")
解决方法:同上


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。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值