Install scala
- Go to https://www.scala-lang.org/downloads and get the tgz package for Unix, MacOS X, Cygwin. The current latest stable release is scala 2.9.1
- Suppose that the downloaded package is in your home directory, open the terminal and type these lines:
$> tar -xvf scala-2.9.1.final.tgz $> sudo mv scala-2.9.1.final/ /usr/share/scala/
Remember to replace the 2.9.1 by your scala version
- The next thing to do is register the SCALA_HOME and PATH environment variable. To do this, open the ~/.profile file and add these new lines to the end of the file
export SCALA_HOME=/usr/share/scala export PATH=$PATH:$SCALA_HOME/bin
- Log out and the log in again. Test you installation by typing this command in the terminal. If the terminal change to scala> then you have successfully installed scala.
$> scala
Install the Netbeans plugin
I use the nbscala plugin to develop scala projects. To use this plugin in Netbeans 6, you can use the Netbeans plugin management in Tools > Plugins. For Netbeans 7.0, you can do as below:
- Go to https://github.com/dcaoyuan/nbscala to get the latest version of this plugin source code or https://sourceforge.net/projects/erlybird/files/nb-scala/ to get the built package.
- Extract your downloaded package to the local storage
- In Netbeans, go to Tools > Plugins choose the Downloaded tab and click Add plugins … button
- Select your new nbm files and click OK, continue to follow what the wizard says.
- Restart the IDE
The first scala application
Now, you can create your first scala project in Netbeans. Just create a new project and keep the default settings, you will have a Hellow world scala application. Click Run. If the the string Hello world is printed in the output then your Netbeans is ready.
I think this tutorial is not completed if you set the system environment SCALA_HOME. Please check it!
I have completely set up my environment like this, and it’s OK now 🙂
Good job !!!!!!!!!!!!!!!!!!!
You can install Scala with:
[code]sudo apt-get install scala[code]