Notes on software development

Menu

Raspberry Pi and Akka / Scala

This post is about running Akka on the Raspberry Pi, but because this is so simple to do I will also talk about a simpler development and deployment process.

Clearly from the posts before you can see that the Java JVM on Raspbian is not very fast, so I looked at a process of developing a Scala / Akka application on my Linux desktop and just copy it to the Raspberry Pi as a Jar file and execute there, to remove the tedious wait during the compilation of my source code.

I used the solution sbt-assembly plugin for sbt to achieve this. It was straightforward to create a single JAR (including the scala library and everything) and then copy it over to the Raspberry Pi.

Here is how it goes:

On your desktop (Linux in my case) you should have the Typesafe Stack installed, then go to your project directory and create a new project with this command (see details on the Typesafe website)

$ g8 typesafehub/akka-scala-sbt
# cd into the newly created directory and
# run with 'sbt run'

Next you need to set up sbt-assembly as described on their website, this involves editing your project/plugins.sbt and ./build.sbt with a few lines.

Then you can run

$ sbt run assembly

to create a big JAR file (about 10 MB) in the target subfolder and copy to your Raspberry Pi with