未能创建 JLineReader (Scala REPL) [英] Failed to created JLineReader (Scala REPL)

查看:38
本文介绍了未能创建 JLineReader (Scala REPL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 64 位 Windows 7 上启动 REPL 时(在我的 Windows XP 笔记本电脑上运行正常),我收到以下消息:

When I start the REPL on Windows 7 64-bit (it works ok on my Windows XP laptop) I get the following message:

Failed to created JLineReader: java.lang.NoClassDefFoundError: Could not initial
ize class org.fusesource.jansi.internal.Kernel32
Falling back to SimpleReader.

这意味着历史和代码完成不起作用.

This means history and code completion don't work.

我用谷歌搜索了这个问题,但我找不到任何解决办法.我没有安装 sbt 或 Maven 或 ivy,所以我认为这与这些无关.我的 %SCALA_HOME% 设置正确.

I have googled the problem but I can't find any resolution. I don't have sbt or Maven or ivy installed so I don't think it's anything to do with those. My %SCALA_HOME% is set up correctly.

在这个线程中有一些关于 Scala 2.8 的依赖:http://www.scala-lang.org/node/9855,但我不明白如何在我的系统上解决这个问题.

There is something about a dependency on Scala 2.8 in this thread: http://www.scala-lang.org/node/9855, but I don't understand how to resolve this on my system.

根据此线程中的建议:http://www.scala-lang.org/node/9795 我已经更新了我的 MS C++ 库,但问题仍然存在.我运行了帖子 #11 中建议的代码并得到以下结果:

As per suggestions in this thread: http://www.scala-lang.org/node/9795 I have updated my MS C++ libraries, but still have the problem. I ran the code suggested in post #11 and get the following:

scala> println(System.getProperty("java.library.path"))

C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\
Windows;C:\Program Files\Common Files\Microsoft Shared\Windows Live;c:\Program F
iles (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Win
dows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files
(x86)\QuickTime\QTSystem\;C:\Program Files (x86)\ZipGenius 6\;C:\Program Files (
x86)\Java\jdk1.6.0_22\bin;C:\Program Files\SlikSvn\bin\;C:\Program Files\apache-
ant-1.8.2\bin;C:\Program Files\TortoiseSVN\bin;C:\cygwin\bin;C:\Program Files (x
86)\Notepad++;C:\Program Files (x86)\groovy-1.7.10\bin;C:\Program Files\scala2.9
\bin

scala> println(org.fusesource.jansi.internal.WindowsSupport.getConsoleMode)

java.lang.NoClassDefFoundError: Could not initialize class org.fusesource.jansi.
internal.Kernel32
        at org.fusesource.jansi.internal.WindowsSupport.getConsoleMode(WindowsSu
pport.java:48)
        at .<init>(<console>:8)
        at .<clinit>(<console>)
        at .<init>(<console>:11)
        at .<clinit>(<console>)
        at $export(<console>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:592)

        at scala.tools.nsc.interpreter.IMain$Request$$anonfun$10.apply(IMain.sca
la:828)
        at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:4
3)
        at scala.tools.nsc.io.package$$anon$2.run(package.scala:31)
        at java.lang.Thread.run(Unknown Source)

感谢任何帮助使其正常工作!

Any help in getting this to work appreciated!

推荐答案

解决方案是输入 del %TEMP%\jansi.dll - 原因请参见下面 huynhjl 的评论.

Solution was to type del %TEMP%\jansi.dll - see huynhjl's comment below for reason.

REPL 似乎与 64 位 JRE 不兼容.我在高级系统设置中更改了我的 JAVA_HOME 环境变量以使用 32 位版本,即从 C:\Program Files\Java\jre6C:\Program Files (x86)\Java\jdk1.6.0_22.

It seems the REPL is incompatible with the 64-bit JRE. I changed my JAVA_HOME environment variable in Advanced System Settings to use the 32-bit version, i.e from C:\Program Files\Java\jre6 to C:\Program Files (x86)\Java\jdk1.6.0_22.

然后我不得不通过从

    if exist "%JAVA_HOME%\bin\java.exe" set _JAVACMD=%JAVA_HOME%\bin\java.exe

    if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"

现在一切正常.

java 足够聪明,可以使用 64 位运行时,而不管您的 Path 或 JAVA_HOME 变量如何,但是 scala 使用您在 JAVA_HOME 中指定的任何内容(其中实际上可能是它应该的样子).但是 64 位运行时比 32 位运行时快很多,所以我想使用它.

java from the command line is smart enough to use the 64-bit runtime regardless of your Path or JAVA_HOME variables, but scala uses whatever you specify in JAVA_HOME (which actually is probably the way it should be). But the 64-bit runtime is a lot faster than the 32-bit one, so I would like to use that.

目前看来我必须在功能齐全的 REPL 和在 64 位 JVM 上运行之间做出选择.:(

At the moment it looks like I have to choose between a fully functional REPL and running on a 64-bit JVM. :(

这篇关于未能创建 JLineReader (Scala REPL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆