Getting started with a new web framework can be a bit scary. Luckily, Scalatra is easy to install, as it has relatively few dependencies.
It can run on Windows, Mac OS X, Linux, or BSD.
1. Install a JDK
Scalatra is web micro-framework written in Scala, so you'll need to have a Java Development Kit (JDK) installed. Many systems come with a JDK pre-loaded.
java -version and
javac -version in a terminal to find if yours
does. The output should look something like this:
$ java -version java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-3) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
$ javac -version javac 1.6.0_24
You need version 1.6 or higher.
If you don't yet have Java installed, you can find out how to install
it for your system
over at the Java 7 install page.
Make sure you're using OpenJDK or Sun's JDK.
Some Linux distros pre-install
gcj, which won't work.
2. Install giter8
Once you're sure you've got Java installed, you will need to download a few other utilities.
Conscript is a tool for installing and updating Scala code. giter8, which depends on conscript, allows you to check out project templates directly from Github. It's the recommended way to generate Scalatra project skeletons.
This will create a
bin folder in your home directory.
Make sure it's in your
PATH by adding the following to your shell's
~/.bash_profile on Mac and
~/.bashrc on Linux):
PATH=$PATH:~/bin export PATH source ~/.bash_profile # (Mac) source ~/.bashrc # (Linux)
Depending on your connection speed, this can take a bit of time, as
conscript downloads quite a few Scala dependencies.
With installation out of the way, head over to the "first project" page, which will show you how to generate, build, and run a Scalatra application.