我使用錯誤:對象的工具是不是包斯卡拉VAR值的成員:scala.tools.nsc.interpreter.IMain
- IntelliJ IDEA的126.330
- 斯卡拉插件0.7.142
- JVM 1.6
- 斯卡拉2.10
- 在Windows 7 64位
決定嘗試Scala和寫˚F下拉應用程序
object main {
def main(args: Array[String]) {
println("Hello, world!")
}
}
然後我創建了Scala控制檯運行配置。當我試圖運行它,我得到控制檯
"C:\Program Files (x86)\Java\jdk1.6.0_32\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:16352,suspend=y,server=n -Djline.terminal=NONE -Dfile.encoding=UTF-8 -classpath "C:\work\scala-2.10.0-RC2\lib\scala-compiler.jar;C:\work\scala-2.10.0-RC2\lib\scala-library.jar;C:\work\scala-2.10.0-RC2\lib\scala-reflect.jar;C:\Users\root\.IntelliJIdea12\config\plugins\Scala\lib\scala-plugin-runners.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 126.330\lib\idea_rt.jar" org.jetbrains.plugins.scala.compiler.rt.ConsoleRunner -classpath "C:/Users/root/IdeaProjects/testScala/out/production/testScala;C:/work/scala-2.10.0-RC2/lib/scala-actors.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/jce.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/localedata.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/resources.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/jsse.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/sunjce_provider.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/rt.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/charsets.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/deploy.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/dnsns.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/management-agent.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/sunmscapi.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/javaws.jar;C:/work/scala-2.10.0-RC2/lib/scala-library.jar;C:/work/scala-2.10.0-RC2/lib/scala-swing.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/plugin.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/sunpkcs11.jar;" -usejavacp2 -Y2log-classpath
Connected to the target VM, address: '127.0.0.1:16352', transport: 'socket'
Welcome to Scala version 2.10.0-RC2 (Java HotSpot(TM) Client VM, Java 1.6.0_32).
Type in expressions to have them evaluated.
Type :help for more information.
scala> <console>:5: error: object tools is not a member of package scala
var value: scala.tools.nsc.interpreter.IMain = _
^
<console>:6: error: object tools is not a member of package scala
def set(x: Any) = value = x.asInstanceOf[scala.tools.nsc.interpreter.IMain]
^
以下輸出google搜索,我發現建議,-usejavacp
參數傳遞到應用程序之後。它有助於擺脫錯誤,但應用程序未被執行。我在控制檯上看到的所有內容都是
"C:\Program Files (x86)\Java\jdk1.6.0_32\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:16383,suspend=y,server=n -Djline.terminal=NONE -Dfile.encoding=UTF-8 -classpath "C:\work\scala-2.10.0-RC2\lib\scala-compiler.jar;C:\work\scala-2.10.0-RC2\lib\scala-library.jar;C:\work\scala-2.10.0-RC2\lib\scala-reflect.jar;C:\Users\root\.IntelliJIdea12\config\plugins\Scala\lib\scala-plugin-runners.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 126.330\lib\idea_rt.jar" org.jetbrains.plugins.scala.compiler.rt.ConsoleRunner -classpath "C:/Users/root/IdeaProjects/testScala/out/production/testScala;C:/work/scala-2.10.0-RC2/lib/scala-actors.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/jce.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/localedata.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/resources.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/jsse.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/sunjce_provider.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/rt.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/charsets.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/deploy.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/dnsns.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/management-agent.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/sunmscapi.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/javaws.jar;C:/work/scala-2.10.0-RC2/lib/scala-library.jar;C:/work/scala-2.10.0-RC2/lib/scala-swing.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/plugin.jar;C:/Program Files (x86)/Java/jdk1.6.0_32/jre/lib/ext/sunpkcs11.jar;" -usejavacp -Y2log-classpath
Connected to the target VM, address: '127.0.0.1:16383', transport: 'socket'
Welcome to Scala version 2.10.0-RC2 (Java HotSpot(TM) Client VM, Java 1.6.0_32).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
我也嘗試在IDE選項中禁用Scala編譯服務器。也沒有幫助。
我該如何解決?
使用'Application'運行/調試配置,而不是一個控制檯。 – CrazyCoder 2013-02-22 09:32:09
@CrazyCoder是的,應用程序配置工程。但是,什麼樣的Scala控制檯配置呢? – expert 2013-02-22 09:57:40
用於運行Scala交互式控制檯。 – CrazyCoder 2013-02-22 10:33:47