1.下载

1.1Scala下载

Windows版:http://www.scala-lang.org/download/

Linux版:http://www.scala-lang.org/download/2.11.8.html

拉到下方:

1.2ScalaIDE下载

下载地址:http://scala-ide.org/download/sdk.html

2.Windows下安装Scala

环境:Windows10+JDK1.7+Scala2.11.8

2.1安装

此处,换安装位置:

Done

2.2测试安装是否成功

首先,设置环境变量,我的是这样的:

D:\ImprtantSoft\Scala\bin

然后,打开CMD,输入scala,回车,出现如下,说明安装成功:

定义变量用val和var,定义方法用def ,可以输入下面的语句体验Scala:

scala> 1+3
res0: Int = 4

scala> res0*3+5
res1: Int = 17

scala> res0.*(res1)
res2: Int = 68

scala> println("Hello World!")
Hello World!

scala> var msg = "Hello World!"
msg: String = Hello World!

scala> println(msg)
Hello World!

scala> def max(x:Int,y:Int):Int=if(x<y) y else x
max: (x: Int, y: Int)Int

scala> max(3,9)
res5: Int = 9

scala> val m = max _
m: (Int, Int) => Int = <function2>

scala> m(4,1)
res6: Int = 4

3.Ubuntu 16.04 LTS下安装Scala2.11.8

3.1安装

由于我是在Windows中下载的tgz文件,需要将其传到Ubuntu中,此处使用WinSCP(原理同FTP),首先连接Ubuntu:

然后在home/用户名/文件下创建名为scala-evn文件夹,并将tgz文件拖入:

进入虚拟机中:

Ctrl+Alt+T打开控制台,进入到spark-evn文件夹,切换为root模式,ls列出文件(方便复制),解压:

$ tar –xzvf scala-.tgz

然后更改权限:

$ sudo chmod -R  scala-

查看文件:

然后,回到根目录,配置环境变量PATH:

cd ~
vim .bash_profile

添加环境变量:

export SCALA_HOME=/home/wangchao/spark-evn/scala-
export PATH=$SCALA_HOME/bin:$PATH

Esc后输入:wq保存并退出

然后执行,. .bash_profile(注意. .之间空格)

3.2测试

4.Windows中ScalaIDE安装

下载后(For Scala 2.11.8 window 64版),解压到相应的文件夹:

点击eclipse即可启动,操作与Java eclipse一样。

Scala IDE→new scala project→new scala object(注意不要new scala class),类比于创建 .java文件而不是创建.class文件,下面是测试测序和截图(注意:ScalaIDE跟eclipse一样,拥有快捷提示,Alt+/等快捷键)。

转载请注明链接:

http://www.cnblogs.com/homewch/p/5668464.html

Windows和Linux(Ubuntu)下安装Scala及ScalaIDE的更多相关文章

  1. linux -- Ubuntu下安装和配置Apache2

    在Ubuntu中安装apache 安装指令:sudo apt-get install apache2 启动和停止apache的文件是:/etc/init.d/apache2 启动命令:sudo apa ...

  2. git在windows及linux环境下安装及常用命令

    git在windows下安装 下载地址:https://git-scm.com/ 默认安装即可 验证 git --version git在linux下安装 下载地址:https://mirrors.e ...

  3. tomcat在windows及linux环境下安装

    下载tomcat 下载地址: https://tomcat.apache.org/download-90.cgi 7,8,9的版本都可以下,这里下载最新版本 注意:Binary是编译好的,可以直接使用 ...

  4. jdk8在windows及linux环境下安装

    jdk下载 下载地址:https://www.oracle.com/technetwork/java/javase/downloads/index.html 目前大部分公司内部使用的还是jdk8,大部 ...

  5. maven在windows及linux环境下安装

    maven下载 下载地址:https://maven.apache.org/download.cgi maven在windows下安装 解压到D盘 修改配置文件 进入conf,打开settings.x ...

  6. jenkins在windows及linux环境下安装

    下载 下载地址: https://jenkins.io/download/ 下载windows和linux通用的war包 jenkins在windows下安装 前提:已经安装jdk.tomcat 将w ...

  7. ant在windows及linux环境下安装

    ant下载 http://ant.apache.org/ https://ant.apache.org/bindownload.cgi 历史版本 ant在windows下安装 解压到D盘 新建系统变量 ...

  8. MongoDB在windows及linux环境下安装

    linux下安装配置 整理中... windows下安装配置 1.下载: https://www.mongodb.com/download-center?jmp=nav 2.解压到D盘 3.D:\下创 ...

  9. linux(ubuntu)下安装phantomjs

    1.安装phantomjs ubuntu下sudo apt-get install phantomjs下载的不能用 —-下载程序文件 到官网下载 1.安装phantomjs —-下载程序文件 wget ...

随机推荐

  1. JS_ECMA基本语法中的几种封装的小函数-2

    大家好!今天继续给大家写一下ECMA中的剩下的小函数以及实用的实例: 首先先给大家说一下字符串.数组.数学方法以及json的一点小知识点: 字符串方法: str.length str.charAt(i ...

  2. MyBatis mapper文件中的变量引用方式#{}与${}的差别

    MyBatis mapper文件中的变量引用方式#{}与${}的差别 #{},和 ${}传参的区别如下:使用#传入参数是,sql语句解析是会加上"",当成字符串来解析,这样相比于$ ...

  3. PostgreSQL中COUNT的各条件下(1亿条数据)例子

    test=# insert into tbl_time1 select generate_series(1,100000000),clock_timestamp(),now(); INSERT 0 1 ...

  4. 与你相遇好幸运,Tippecanoe用法

    //todo 基本用法: tippecanoe -o file.mbtiles [file.json ...] 参数解释: <必须>   -o myFileName.mbtiles  或者 ...

  5. poj 1006:Biorhythms(水题,经典题,中国剩余定理)

    Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 110991   Accepted: 34541 Des ...

  6. .NET yield

    .Net Yield 其实比较简单,手动yield,一学就会. public static class GalaxyClass { public static void ShowGalaxies() ...

  7. WPF MVVM初体验

    首先MVVM设计模式的结构, Views: 由Window/Page/UserControl等构成,通过DataBinding与ViewModels建立关联: ViewModels:由一组命令,可以绑 ...

  8. [Linux] 学习笔记之安装学习环境(sshd, lrzsz)

    紧接前一篇,在VMWare安装完Linux,这个时候我们要使用远程工具连接到虚拟机上去了,以前一直使用Putty,后来到新公司之后,推荐使用SecureCRT,使用之后,觉得效果不错,但是每次连接都失 ...

  9. WebStorm中将Project分享到GitHub时报“Error Running Git”错误的解决办法

    错误信息 Cannot run program "git.exe":CreateProcess error=2,系统找不到指定的文件. 解决办法 从错误信息就可以知道,WebSto ...

  10. Java学习笔记(一)——HelloWorld

    一.安装JDK 1.下载链接: http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.直接安装,不能有中文路径 3. ...