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"/>

Having solved the Ant problem, I thought I’d build a simple HelloScala app.

  1. Start Netbeans
  2. Click the New Project icon on the toolbar
  3. Select Scala
  4. Press Next 
  5. Project name = ScalaApplication1
  6. Location = K:\Code (giving Project Folder = K:\Code\ScalaApplication1)
  7. Create main class = ScalaApplication1.Main
  8. Press Finish
  9. Press Shift-F6 to build and run.
  10. Error message: java.lang.NoClassDefFoundError: ScalaApplication1/Main
  11. Change "package __PACKAGE_NAME__" to "package ScalaApplication1"
  12. Change "object __CLASS_NAME__" to"object Mail"
  13. Press Shift-F6 to build and run.
  14. Success!