I'm taking a look at Netbeans 6.0 with the new Scala plugin (http://blogtrader.org/page/dcaoyuan/entry/first_experimental_scala_supporting_for). When I tried to build a HelloScala app, I received the error "Could not load definitions from resource scala/tools/ant/antlib.xml."
Setting SCALA_HOME in my environment variables appears to not work with Windows Netbeans 6.0 final and the Scala plugin.
I've got SCALA_HOME=C:\scala in my environment (which is where my Scala lives). I've confirmed it by starting a Command prompt and typing "set". Yet I still get the scala/tools/ant/antlib.xml error.
However, adding -J-Dscala.home=C:\scala to the end of the netbeans_default_options string in C:\Program Files\NetBeans 6.0\etc\netbeans.conf resolves the problem.
I don't speak ant, but I'm betting that the following snippet from build-impl.xml doesn't behave as expected in some cases:
<condition property="scala.home" value="$">
<isset property="env.SCALA_HOME"/>
</condition>
Having solved the Ant problem, I thought I’d build a simple HelloScala app.
- Start Netbeans
- Click the New Project icon on the toolbar
- Select Scala
- Press Next
- Project name = ScalaApplication1
- Location = K:\Code (giving Project Folder = K:\Code\ScalaApplication1)
- Create main class = ScalaApplication1.Main
- Press Finish
- Press Shift-F6 to build and run.
- Error message: java.lang.NoClassDefFoundError: ScalaApplication1/Main
- Change "package __PACKAGE_NAME__" to "package ScalaApplication1"
- Change "object __CLASS_NAME__" to"object Mail"
- Press Shift-F6 to build and run.
- Success!