Before we run the first helloworld example we need to setup some stuff. You can skip to the Running helloworld below if you have scala and sbt already setup.
The following is how my setup is on a *nix/osx. For windows I am clueless but I am sure we can work out something at the meetup.
Download 2.9.1. Installation is as easy as unpacking it. My scala lives under /opt -- you might have another suitable place for it. A great thing to do is to soft link scala -> scala-2.9.1.final/. After that export the correct path (assuming you created the soft link):
> export PATH = $PATH:/opt/scala/bin
After that you should be able to invoke scala from anywhere at the command-line for some Scala REPL goodness.
Install sbt.
My setup includes a ~/bin directory that is in my PATH. In there I have a sbt-launch-0.11.2.jar and a script sbt11 that goes
#!/bin/sh
if test -f ~/.sbtconfig; then
. ~/.sbtconfig
fi
echo $SBT_OPTS
java ${SBT_OPTS} -jar `dirname $0`/sbt-launch-0.11.2.jar "$@"
The ~/.sbtconfig file is:
export SBT_OPTS="-Dfile.encoding=UTF8 -Xms1024m -Xmx1024m -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Dsbt.boot.directory=$HOME/.sbt/boot/"
Create a directory:
> mkdir ~/.sbt
We will cover plugins for sbt at the meetup.
> git clone https://github.com/ppurang/bbscala
> cd bbscala/00000_meetup/helloworld
> sbt11
-Dfile.encoding=UTF8 -Xms1024m -Xmx1024m -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Dsbt.boot.directory=/home/ppurang/.sbt/boot/
[info] Set current project to helloworld (in build file:/home/ppurang/repositories/github/meri/bbscala/00000_meetup/helloworld/)
Ready to run our first scala program:
> run
[info] Running HelloWorld
Hello World!
[success] Total time: 0 s, completed Dec 4, 2011 9:52:23 AM
Congrats your setup clicked. And don't worry if things weren't as successful - that is one of the reasons why we meet.
I would recommend Intellij Community Edition with the scala plugin. Here is a good writeup on setting up your intellij and other IDEs:
https://github.com/coreyhaines/coderetreat/tree/master/starting_points/scala
In case you don't have one do create one. Another great place is https://bitbucket.org/.