Using 7.0? See #194235 for discussion.

Scala Plugins for NetBeans 6.9.x


New & Noteworthy

  • Fixed: Error and warning markers on Windows
  • Fixed: Go-To-Source on Windows
  • Fixed: Go-To-Source across dependent Maven projects.
  • Use dependencies aware scalac task instead of fsc for default Scala project
  • Much more responsive when typing and for code-completion
  • More refactoring: find usages, rename across opened projects
  • Breakpoint works everywhere
  • Better supporting for mixed Java/Scala project in both direction (Java is visible in Scala and vice versa)
  • Better integration with NetBeans maven plugin
  • Better code completion even for implicit methods (in most cases)
  • Better indentation and formatter for unfinished line after if, else, =, for, while, do etc
  • Better syntax highlighting for val/var, lazy val, implicit call, byname param, abstract method etc
  • Mark of implemented/overridden methods, click on mark will jump to super definition
  • Go to type ("Ctrl+O")
  • Select parts of code, press {, [, (, ", ` will add/replace surrounding pair, press ~ will remove them. Specially, press / will block-comment it
  • Reset Scala interactive parser when necessary, for instance: dependent libs changed (Right click on source, choose "Reset Scala Parser" in pop-up menu)
  • Output highlighted code to html ([File] -> [PrintToHTML...]) (Can be then copied/pasted to Word, PowerPoint, Keynote etc. See example)
  • Some basic hints, for instance: fixing import, unused imports
  • Code template now works, check or add your own via [Options/Preferences] -> [Editor] -> [Code Templates] -> [Scala]
  • Fixed breakpoint issue under Windows

Install with NetBeans 6.9

  1. Download and install Scala-2.8.x runtime via
    • Note for Windows user: do not install Scala runtime under path/directory with embed space.
  2. Set $SCALA_HOME environment variable to point to the installed Scala runtime path. Add $SCALA_HOME/bin to PATH environment variable.
    • Note for Mac OS user: $SCALA_HOME environment variable may not be visible for Applications/NetBeans, see [1]. Or Adding -J-Dscala.home=/path/to/scala/home to the end of netbeansInstall/etc/netbeans.conf might be sufficient without creating the MacOSX env plist
    • Note for Linux user: if your $SCALA_HOME environment variable is not visible for NetBeans, see [2]
  3. Get the NetBeans 6.9.x from:
  4. If you have previous NetBeans installed:
    • Remove $UserHome/.netbeans/6.7 or rename it to $UserHome/.netbeans/back6.7
    • Remove $UserHome/.netbeans/6.8 or rename it to $UserHome/.netbeans/back6.8
    • Answering "No" to the question of "Importing old configuration of ..." if it shows
  5. Get the Scala plugins binary from:
  6. Unzip Scala plugin binary to somewhere
  7. Open NetBeans, go to "Tools" | "Plugins", click on "Downloaded" tab title, click on "Add Plugins..." button, choose the directory where the Scala plugins are unzipped, select all listed *.nbm files, following the instructions.
  8. Edit $NetBeansInstallationPath/etc/netbeans.conf
    • You may need to increase maximum heap memory size etc, for instance: -J-Xmx1024m -J-XX:MaxPermSize=500m
    • remove "-J-ea" if there is one to avoid AssertionError window popup


Reset Scala parser when necessary

Sometimes, the dependent project is rebuilt or newly added, or the dependent jars are changes, the editor may not recognize these changes and shows error messages, you can right-click on source file, choose "Reset Scala Parser" in the popped menu, then switch to another editor window, and go back.

Could not connect to compilation daemon

If you encounter "... Could not connect to compilation daemon.", try to run "fsc -reset" under a command/terminal window. (From v1.1.0, "fsc" is not support any more, please use dependencyfile setting instead)

How to Set Path to Scala Runtime Library

Each release of Scala plugin may support several scalac compatible Scala runtime libraries. For ant based project, the building process always use the Scala runtime library under $SCALA_HOME. For Maven based project, it always use the Scala runtime library configured in pom.xml.

How to Set Building Heap Size

For ant based project, set something like:

ANT_OPTS=ANT_OPTS='-Xmx1024m -XX:MaxPermSize=512m'

For Maven based project, you need to set the jvmArgs for maven-scala-plugin in your pom.xml file


Current Code Template

NetBeans supports custom code template, you can check or add via [Options/Preferences] -> [Editor] -> [Code Templates] -> [Scala]

To invoke, just type the abbreviation, for example, "ca", then press "Tab" key.

The followings are predefined:

  <codetemplate abbreviation="ex">
    <code>extends </code>
  <codetemplate abbreviation="re">
    <code>return </code>
  <codetemplate abbreviation="ma">
    <code>match {</code>
  <codetemplate abbreviation="pr">
    <code>private </code>
  <codetemplate abbreviation="ov">
    <code>override </code>
  <codetemplate abbreviation="sy">
    <code>synchronized </code>

  <codetemplate abbreviation="th">

  <codetemplate abbreviation="iff">
      <![CDATA[if (${cursor}) else]]>

  <codetemplate abbreviation="ca">
      <![CDATA[case ${cursor} =>]]>

  <codetemplate abbreviation="bcom">

  <codetemplate abbreviation="fcom">
      <![CDATA[// <editor-fold defaultstate="collapsed" desc="${comment}">
${selection}${cursor}// </editor-fold>


For Windows user

please do not create projects under directory that contains space. Otherwise you may encounter something like (WIll try to fix it in next release):

Compiling 1 source file to C:\Documents and Settings\myuser\My Documents\NetBeansProjects\ScalaApplication1\build\classes
C:\Documents and Settings\myuser\My Documents\NetBeansProjects\ScalaApplication1\nbproject\build-impl.xml:403:
The following error occurred while executing this line:
C:\Documents and Settings\myuser\My Documents\NetBeansProjects\ScalaApplication1\nbproject\build-impl.xml:236:
don't know what to do with and
BUILD FAILED (total time: 0 seconds)
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo