Akka Environment Set-Up
Fall-2141
Download the Akka core libraries from: http://downloads.typesafe.com/downloads/archive/akka-core-1.2.zip and extract to a location of your choice. These libraries are already
installed on the SE Lab image. Mac users, you are on your own. This
will install all the libraries required for the Java API.
Running Java programs with Akka:
In
the lab you will need to run the shell script akkalibs-labs.sh to set-up your
CLASSPATH correctly.
AKKA_HOME='c:/Program Files (x86)/typesafe-stack'
AKKA_JARS="${AKKA_HOME}"/config\;"${AKKA_HOME}"/lib/scala-library.jar\;"${AKKA_HOME}"/lib/akka/multiverse-alpha-0.6.2.jar\;"${AKKA_HOME}"/lib/akka/akka-stm-1.2.jar\;"${AKKA_HOME}"/lib/akka/akka-actor-1.2.jar
CLASSPATH=`echo "${CLASSPATH};${AKKA_JARS}" | sed 's/^;/.;/'`
export CLASSPATH
If you installed akka-core-1.2 on your own
machine, you will need to change the AKKA_HOME variable to match where
you installed it.
AKKA_HOME='c:/Program Files (x86)/akka-core-1.2'
AKKA_JARS="${AKKA_HOME}"/config\;"${AKKA_HOME}"/lib/scala-library.jar\;"${AKKA_HOME}"/lib/akka/multiverse-alpha-0.6.2.jar\;"${AKKA_HOME}"/lib/akka/akka-stm-1.2.jar\;"${AKKA_HOME}"/lib/akka/akka-actor-1.2.jar
CLASSPATH=`echo "${CLASSPATH};${AKKA_JARS}" | sed 's/^;/.;/'`
export CLASSPATH
For example, to run the ActorDemo example in cygwin:
#
cd work/SWEN-342/ActorDemo
(wherever you copied the sample files to)
#
. akkalibs-labs.sh
(if you get an error, try
converting doing "dos2unix *.sh" )
# javac ActorDemo.java
# java ActorDemo
Other demos:
Producer-Consumer with Actors
Eclipse Set-Up
To
work in Eclipse you simply need to modify the Eclipse Project's build
path to include the jar files referenced in the script listed above.
- Right click on your project , select Properties->Java Build Path->Libraries->Add External Jar JAR's...
- Navigate to the Akka installation directory and add each Akka jar file. On the SE Lab machines they are found here:
- c:/Program Files (x86)/typesafe-stack/lib/scala-library.jar
- c:/Program Files (x86)/typesafe-stack/lib/akka/multiverse-alpha-0.6.2.jar
- c:/Program Files (x86)/typesafe-stack/lib/akka/akka-stm-1.2.jar
- c:/Program Files (x86)/typesafe-stack/lib/akka/akka-actor-1.2.jar