在Netbeans中编译Hello World程序时出现以下错误:
C:UsersNormanDocumentsNetBeansProjectsLambdaCollectionExamplesScalaApplication2nbprojectbuild-impl.xml:238: bad option: '-make:transitive'.
这是xml文件:-
<scalac addparams="-make:transitive -dependencyfile "${basedir}/${build.dir}/.scala_dependencies" @{addparams}"
deprecation="${scalac.deprecation}"
destdir="@{destdir}"
encoding="${source.encoding}" excludes="@{excludes}"
extdirs="@{extdirs}"
force="yes"
fork="true"
includes="@{includes}"
sourcepath="@{sourcepath}"
srcdir="@{srcdir}"
target="jvm-${javac.target}"
unchecked="${scalac.unchecked}">
程序
package scalaapplication2
object Main {
/**
* @param args the command line arguments
*/
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
Scala 2.11.2给了我这样的错误。下载Scala 2.10.4二进制文件,您的系统应该可以解决这个问题。
ant -f C:\Users\wayne\Documents\NetBeansProjects\ScalaApplication2 run
init:
deps-jar:
Compiling 1 source file to C:UserswayneDocumentsNetBeansProjectsScalaApplication2buildclasses
Recompiling 1 files
warning: there were 1 deprecation warning(s); re-run with -deprecation for details
one warning found
compile:
run:
Hello, world!
BUILD SUCCESSFUL (total time: 3 seconds)