首页 > 系统服务 > 详细

如何在Ubuntu上配置scala教程

时间:2016-01-15 14:30:35      阅读:229      评论:0      收藏:0      [点我收藏+]

Scala是一门多范式的编程语言,一种类似java的编程语言,设计初衷是实现可伸缩的语言 、并集成面向对象和函数式变成的各种特性。这里为了学习spark特地配置了scala.

1、下载scala安装包:

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

      选择最新的安装包下载,进行保存;

2、解压安装包到自己的目录,我解压在了opt目录下

  root@ubuntu:/opt# mkdir ./scala

  root@ubuntu:/opt/scala# tar zxvf ../../home/parry/Downloads/scala-2.11.7.tgz

3、配置环境变量:

  打开profilr:

  root@ubuntu:/opt/scala/scala-2.11.7# gedit /etc/profile

  在最后添加配置:

  #SCALA setting
  export SCALA_HOME=/opt/scala/scala-2.11.7(这里是上面的解压路径)
  export PATH=#SCALA_HOME/bin;$PATH

  保存退出

4、安装scala:

   (1)输入scala

    root@ubuntu:/opt/scala/scala-2.11.7# scala

    提示还未安装

    The program ‘scala‘ is currently not installed. You can install it by typing:
    apt-get install scala

    根基提示输入apt-get install scala进行安装
    root@ubuntu:/opt/scala/scala-2.11.7# apt-get install scala

    提示下载更新和资源包:这里根据提示输入Y就可以;等到下载完成

    1 upgraded, 28 newly installed, 0 to remove and 250 not upgraded.
    Need to get 64.1 MB/64.4 MB of archives.
    After this operation, 98.6 MB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
  (2)输入scala -version 产看scala版本信息:

    root@ubuntu:/opt/scala/scala-2.11.7# scala -version
    Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL

    这里scala安装完成。
5、scala测试:

  (1)输入scala进入scala,输入

    root@ubuntu:/opt/scala/scala-2.11.7# scala

    Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79).
    Type in expressions to have them evaluated.
    Type :help for more information.
  (2)输入1+1进行计算
    scala> 1+1
    res0: Int = 2
    scala>

 

    


  

如何在Ubuntu上配置scala教程

原文:http://www.cnblogs.com/parryyang/p/5132980.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!