Scala Hello World Primer Tutorial

Scala Hello World Primer Tutorial

Scala Hello World Primer Tutorial

The Scala programming language is a burgeoning force in Information Technology …

Object-Oriented Meets Functional
Have the best of both worlds. Construct elegant class hierarchies for maximum code reuse and extensibility, implement their behavior using higher-order functions. Or anything in-between.

… and we want to find out more about it, so today we start down that long and winding road. So where else would a beginner begin, barring running a complete sample project, as to construct our own Hello World Scala application, with a lot of help from others (thanks), ourselves.

Steps in getting together a Scala command line Hello World application, and to ready the NetBeans 8.0.2 IDE for Scala Sbt Project creations into the future, given our NetBeans 8.0.2 / No Scala / Java SE 1.7 starting point, involved …

  1. Java SE 1.8 is needed for Scala (via sbt) work and we installed via HTTP://
  2. Install Scala 2.12.0 via
  3. Make it work on command line in our /usr/local/bin/scala-2.12.0 base directory, on our command line (via Terminal) $PATH
  4. Advice of had us reinstalling Xcode command line tools from Apple Developer Store because of recent upgrade of Mac OS X to macOS Sierra Version 10.12.1 … followed by

    sudo xcodebuild -license
  5. Reinstall base Macports via Download button of because of recent upgrade of Mac OS X to macOS Sierra Version 10.12.1
  6. Install sbt version 0.13.11 via Macports …

    sudo port install sbt

    … alternatively install via sbt landing page

    The interactive build tool
    Use Scala to define your tasks. Then run them in parallel from the shell.

  7. Start up NetBeans 8.0.2
  8. Tools -> Java Platforms show Java SE 1.8
  9. Tools -> Scala Platforms shows no relationships
  10. Tools -> Plugins -> Available Plugins … Sort and check all the Scala ones and -> Install … as you can see a bit of with today’s tutorial picture
  11. Tools -> Scala -> Sources tab -> Add JAR/Folder… and add all the *.jar in /usr/local/bin/scala-2.12.0/lib directory
  12. At Terminal command line …

    $ cd $HOME
    $ pwd
    $ mkdir scala_sbt_hello_world
    $ cd scala_sbt_hello_world
    $ echo 'object Hi { def main(args: Array[String]) = println("Hello World ... Scala fans!") }' > helloworld.scala
    $ sbt
    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0
    [info] Set current project to scala_sbt_hello_world (in build file:/Library/pgAgent/scala_sbt_hello_world/)
    > run
    [info] Updating {file:/Library/pgAgent/scala_sbt_hello_world/}scala_sbt_hello_world...
    [info] Resolving org.fusesource.jansi#jansi;1.4 ...
    [info] Done updating.
    [info] Compiling 1 Scala source to /Library/pgAgent/scala_sbt_hello_world/target/scala-2.10/classes...
    [info] 'compiler-interface' not yet compiled for Scala 2.10.6. Compiling...
    [info] Compilation completed in 24.13 s
    [info] Running Hi
    Hello World ... Scala fans!
    [success] Total time: 44 s, completed 04/12/2016 3:37:10 PM
    > exit

Great help (thanks heaps) came from …

You may face the same dilemmas as us, so below is a list of pertinent “other” parts of the Scala research and development …

We hope, if you are one of those interested in Scala, this tutorial helps a little with your launching into finding out more.

If this was interesting you may be interested in this too.

This entry was posted in eLearning, NetBeans, Operating System, Tutorials and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>