Here is the step by step procedure to set up the scala(2.9) environment with Netbeans(7.2) on a Windows Vista system
1. Install Netbeans 7.2 Beta if not already installed from here.
2.†Download the Scala installable from†here. Install Scala on your system.
3.†Set the environment variable SCALA_HOME pointing it to the Scala installation directory. (On Windows Vista, Go to Start Menu ->Right click on Computer -> Select Properties -> From the left menu, Click on Advanced system Settings -> Click on the Environment variables button on the bottom right corner -> Create new System variable named SCALA_HOME pointing to the Scala installation directory).
4. Now we need to install Scala plugin for Netbeans. Download the plugin†here†and extract the content into an appropriate folder.
5. Open Netbeans IDE.
6. On the Menu Bar, choose Tools -> Plugin
7. Choose†Downloaded tab. Click on Add Plugins button.†Browse to the folder containing scala plugins. Choose all the *.nbm files and hit the Install button on the bottom left corner.
5. You need to hit the Next / Continue button and accept the agreements on all the windows that pop up after that.
Plugin auto installs everything.
6.†Create New Project. You should now be able to see a new category named Scala. Choose Scala Application. Choose your project name / location and click on Finish. An object named Main which prints out “Hello World” gets created by default. You can run this file as is by hitting Shift+F6 just to check if the environment is correctly set. HelloWorld should get printed as output.
Writing a first Scala program on Netbeans 7.2 seemed a breeze. No headache of conf file changes. But Netbeans 7.2 does seem a lot lot slower than its earlier version 7.0(I have not tried 7.1). Probably because it still is a Beta version.
Following are some gotchas†if you are trying to get Scala to work on Netbeans 7.0 or an earlier version of Scala-
1. After installing the plugin, you should be able to create a new Scala project. In case you are not, check if any of the scala plugins are not activated. Select them and activate them.
2. Error message – Could not load definitions from resource scala/tools/ant/antlib.xml. It could not be found.
Solution – Check if Scala has been correctly installed. Append “-J-Dscala.home=scalahomepath” property to the end of “netbeans_default_options” in NetBeansInstallationPath/etc/netbeans.conf where scalahomepath is the actual path to the Scala installation directory.
Please do let me know how your Scala environment setup with Netbeans went. I will be happy to respond to your questions if any. Please feel free to add your comments below.
Adios until the next post !