Reputation: 21
I am a beginner learning to program in scala-akka and I have had no problems running my scripts on IntelliJ IDE / and 'sbt run'. However, I can't seem to find any resources that teaches me how to manually use scalac and the akka jar dependency to compile and run just from the command-line. Can anyone point me in the right direction?
Upvotes: 0
Views: 231
Reputation: 22449
Let's assume you have Scala and Akka installed somewhere under /home/leo/apps/ and Scala binaries are searchable (e.g. export PATH=$PATH:home/leo/apps/scala-2.11.8/bin
)
Next, let's say you have a Scala main app Tweets.scala
along with a few supplementary classes packaged in akkastreams
under /home/leo/myproject/:
akkastreams/
Tweets.scala
Author.scala
HashTag.scala
Message.scala
...
Here's how you'll compile and run the app:
cd /home/leo/myproject/
# Compile all files in package akkastreams:
scalac -cp "/home/leo/apps/akka-2.4.9/lib/akka/*" akkastreams/*.scala
# Run the main app Tweets (object Tweets extends App):
# Note that classpath includes also current subdir '.'
scala -cp "/home/leo/apps/akka-2.4.9/lib/akka/*:." akkastreams.Tweets
A few notes:
sbt
, you'll need to manually maintain version consistency between Scala's bundled Akka libraries versus Akka's own ones.Upvotes: 1
Reputation: 134
In my opinion You should perform scalac
and scala
with classpath parameter and selected library jar file.
By the way it's still more convenient to use sbt.
Upvotes: 0