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.
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.
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.
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!
EDIT: Solution was to type del %TEMP%\jansi.dll
- see huynhjl's comment below for reason.
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
.
Then I had to correct the bug (that is STILL there) in the scala.bat
file by changing line 24 from
if exist "%JAVA_HOME%\bin\java.exe" set _JAVACMD=%JAVA_HOME%\bin\java.exe
to
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
and it works OK now.
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.
At the moment it looks like I have to choose between a fully functional REPL and running on a 64-bit JVM. :(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With