Scala on MAC(1)Environment on MAC

本文详细介绍了如何在macOS上安装并使用Scala IDE,并提供了几个基本的Scala编程示例,包括如何导入和学习一个样本项目,以及如何通过Eclipse进行Scala开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Scala on MAC(1)Environment on MAC
Download the 3.7 version of eclipse, do not use the latest 4.2 ones.

The plugin URL is as follow: http://download.scala-ide.org/releases-29/stable/site

Download the scala file from URL http://www.scala-lang.org/downloads/distrib/files/scala-2.9.2.tgz
file name is scala-2.9.2.tgz

Unzip the file and copy to my tool directory, link this directory to /opt
>sudo ln -s /Users/username/tool/scala-2.9.2 /opt/scala

>sudo vi ~/.profile
export SCALA_HOME=/opt/scala
export PATH=/opt/scala/bin:$PATH
>. ~/.profile

Verify the installation with below command
>scalac -version
Carls-MacBook-Pro:opt carl$ scalac -version
Scala compiler version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL

Use command to enter the scala
>scala
scala>1+2

2. Import and Learn sample project
Install some other plugins
MAVEN
http://m2eclipse.sonatype.org/sites/m2e

GIT
http://download.eclipse.org/egit/updates

Android
https://dl-ssl.google.com/android/eclipse/

3. Try the first example
>vi hello.scala
object HelloWorld{ def main(args: Array[String]){
println("Happy Valenten's Day, Kiko.")
}
}
>scala hello.scala

4. Try the IDE with eclipse
package com.sillycat.easyscala.bak

object Love {
//args parameter name
//Array[String] parameter type
//Unit return type, equals to void
def main(args: Array[String]): Unit = {
//val is equals to final String exp
val exp: String = "Happy Valenten's Day"
val name = "Kiko"
//String v = ""
var v = exp + ", " + name
println(v)
}

}

references:
http://sillycat.iteye.com/blog/1405907

http://sillycat.iteye.com/blog/1536386
http://sillycat.iteye.com/blog/1536391
http://sillycat.iteye.com/blog/1536392
http://sillycat.iteye.com/blog/1481372

http://developer.android.com/guide/google/gcm/index.html
http://code.google.com/p/gcm/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值