FROM: http://j-q-j.org/scala/scala-2-11-application-error.html

这两天学习scala,官网下载的最新版本2.11,书用的是《Programming in scala》,看到类和对象,这一章最后一段代码

1
2
3
4
5
import ChecksumAccumulator.calculate
object FallWinterSpringSummer extends Application {
  for (season <- List("fall", "winter", "spring"))
     println( season + ": " calculate(season))
}

scalac FallWinterSpringSummer.scala报错如下

1
error: not found: type Application

查找scala官方api,发现内置了Application类的,不知道哪里出错了,书的示例代码照样编译出错。

百度搜索未果,FQgoogle好不容易才发现结果,最后发现stackoverflow大神的解释

http://stackoverflow.com/questions/26176509/why-does-2-11-1-fail-with-error-not-found-type-application

Application has been deprecated from scala 2.9, probably it has been deleted in scala 2.11 (it still exists in scala 2.10) even though at the moment I can't find proofs for that, use App instead.

Proof found, this is the scala 2.11 branch on github which has only an App.scala and this is the 2.10which has App.scala and Application.scala with a deprecated warning.

scala 2.9以后的版本废弃了Application而是启用了App类,修正后代码如下

1
2
3
4
5
import ChecksumAccumulator.calculate
object FallWinterSpringSummer extends App {
  for (season <- List("fall", "winter", "spring"))
     println( season + ": " calculate(season))
}

还是不要赶时髦的好,乖乖下载个2.9继续搞。

scala 2.11报错error: not found: type Application的更多相关文章

  1. MySQL 8.0.11 报错[ERROR] [MY-011087] Different lower_case_table_names settings for server ('1')

    --报错信息: 2018-06-07T19:52:26.943083+08:00 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld ...

  2. linux使用wkhtmltopdf报错error while loading shared libraries:

    官网提示 linux需要这些动态库.depends on: zlib, fontconfig, freetype, X11 libs (libX11, libXext, libXrender) 在li ...

  3. LR调试脚本的时候报错Error -27796:(已解决)

    LR调试bbs脚本的时候报错: 1.Error -27796: Failed to connect to server "192.168.211.128:80": [10060] ...

  4. 发布报错:Error ITMS-90635 - Invalid Mach-O in bundle - submitting to App store

    发布报错:Error ITMS-90635 - Invalid Mach-O in bundle - submitting to App store 昨晚上传项目到AppStore,报了这个错,纳尼! ...

  5. 升级到macOS 10.12 mysqlb报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    系统升级到macOS 10.12后启动mysql后,在终端输入mysql 报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' ...

  6. inoic start projectname sidemenu报错 - Error: Cannot find module 'lodash._baseslice'

    inoic start projectname sidemenu报错 - Error: Cannot find module 'lodash._baseslice' 在公司的电脑上出现过这个错误,后来 ...

  7. 运行编译后的程序报错 error while loading shared libraries: lib*.so: cannot open shared object file: No such file or directory

    运行编译后的程序报错  error while loading shared libraries: lib*.so: cannot open shared object file: No such f ...

  8. CentOS命令登录MySQL时,报错ERROR 1045 (28000):

    CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解 ...

  9. android sdk启动报错error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037:

    android sdk启动报错error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: 问题原因: ...

随机推荐

  1. Maximum Subarray——经典

    Find the contiguous subarray within an array (containing at least one number) which has the largest ...

  2. css 三(清除浮动专题)

    1.  三个关于浮动的概念  不浮动float:none; 清除周围的浮动元素   float:both   这是清除浮动的本意 清除子元素浮动对父元素的影响  clearfix    很多人都理解成 ...

  3. C++ cin.ignore()用法

    cin.ignore(int a,char b); a为一行中最大读取字符长度,b为某一个字符.在缓冲区中寻找b,找到后忽略b以前的所有字符(包括b).如果在a的范围内还没有找到b,则忽略b以前的所有 ...

  4. ViewPager单页显示3个item

    原文地址:https://github.com/hongyangAndroid/MagicViewPager/wiki MagicViewPager 单页显示3个Item的ViewPager炫酷切换效 ...

  5. Python3 字典及三级菜单练习

    #!/usr/bin/env python3 # -*- coding: utf-8 -*- # Author;Tsukasa list_1 = { '广州':{ '越秀区':{ '五羊石像','镇海 ...

  6. 循序渐进PYTHON3(十三) --4-- DJANGO之CSRF使用

    用 django 有多久,跟 csrf 这个概念打交道就有久. 每次初始化一个项目时都能看到 django.middleware.csrf.CsrfViewMiddleware 这个中间件 每次在模板 ...

  7. Arduino可穿戴开发入门教程Arduino开发环境介绍

    Arduino可穿戴开发入门教程Arduino开发环境介绍 Arduino开发环境介绍 Arduino不像我们使用的PC端操作系统一样,可以直接在操作系统中安装软件为操作系统编程.Arduino的软件 ...

  8. BZOJ 2296【POJ Challenge】随机种子(构造)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2296 [题目大意] 给出一个数x,求一个10的16次以内的数使得其被x整除并且数字包含 ...

  9. [xsy1144]选物品

    题意:给定$a_{1\cdots n},b_{1\cdots n}$,询问是给定$l,r$,找出$a',b'$使得$\sum\limits_{i=l}^r\max(\left|a'-a_i\right ...

  10. 【枚举】【尺取法】hdu6103 Kirinriki

    两个等长字符串A,B的距离被定义为 给你一个字符串,问你对于所有长度相等的不相交子串对,其距离不超过m的前提下,最长的长度是多少. 枚举对称轴,两侧先贪心地扩展到最长,超过m之后,再缩短靠近对称轴的端 ...