This page is no longer maintained — Please continue to the home page at www.scala-lang.org

No JLineReader in REPL

15 replies
Jan van der Vorst
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.

Since 2.9.0 when starting the REPL (both in a cmd shell and in a
cygwin bash shell) I get the message:
Failed to created JLineReader: java.lang.NoClassDefFoundError: Could
not initialize class org.fusesource.jansi.internal.Kernel32

The result is that there is no 'history' in the REPL, making it very
hard to use.
I am working in Windows XP with Scala version 2.9.0.1 (Java
HotSpot(TM) Client VM, Java 1.6.0_25)

I have seen some proposed patches in the scala-language group but I
can't get any of them to work for me.
Also I can't find any open bug-report regarding this problem.

Is this a known problem?
Should I file a bug-report?

thanks,
Jan van der Vorst

marc
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL
Jan,
I had a similar issue where sbt console was not echoing text.  I am not sure if this is your issue, however, comment #5  here fixed the issue for me.
Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: Re: No JLineReader in REPL

i had the same problem with sbt console when moving to 0.7.7. this is how i fixed it:

$ rm -r ~/.ivy2/sbt/
$ rm -r project/boot
$ sbt clean-cache

it was sufficient to remove ~/.ivy2/sbt so i didn't need to delete all my cache. it seems that this directory hasn't be recreated yet by sbt, so maybe it was something specific to sbt 0.7.5 ?

best, -sciss-

On 2 Jun 2011, at 17:41, marc wrote:

> Jan,
>
> I had a similar issue where sbt console was not echoing text. I am not sure if this is your issue, however, comment #5 here fixed the issue for me.

huynhjl 2
Joined: 2011-03-26,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

I'm not exactly sure on the circumstances when that happens, but I've
had similar issues when the jline/jansi dlls cannot be written to the
temp directory.

with cmd.exe try this:
del %TEMP%\jansi.dll
del %TEMP%\jline_.dll

then try again.

With cygwin, use (as bootcp interferes with dll loading):
scala -nobootcp

--Jean-Laurent

On Jun 2, 8:35 am, Jan van der Vorst wrote:
> Since 2.9.0 when starting the REPL (both in a cmd shell and in a
> cygwin bash shell) I get the message:
> Failed to created JLineReader: java.lang.NoClassDefFoundError: Could
> not initialize class org.fusesource.jansi.internal.Kernel32
>
> The result is that there is no 'history' in the REPL, making it very
> hard to use.
> I am working in Windows XP with Scala version 2.9.0.1 (Java
> HotSpot(TM) Client VM, Java 1.6.0_25)
>
> I have seen some proposed patches in the scala-language group but I
> can't get any of them to work for me.
> Also I can't find any open bug-report regarding this problem.
>
> Is this a known problem?
> Should I file a bug-report?
>
> thanks,
> Jan van der Vorst

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Re: No JLineReader in REPL

None of these solutions have worked for me. I have erased ivy2, m2,
project/boot, done sbt clean-cache, and I still have this problem.

On Thu, Jun 2, 2011 at 14:14, Sciss wrote:
> i had the same problem with sbt console when moving to 0.7.7. this is how i fixed it:
>
> $ rm -r ~/.ivy2/sbt/
> $ rm -r project/boot
> $ sbt clean-cache
>
> it was sufficient to remove ~/.ivy2/sbt so i didn't need to delete all my cache. it seems that this directory hasn't be recreated yet by sbt, so maybe it was something specific to sbt 0.7.5 ?
>
> best, -sciss-
>
>
> On 2 Jun 2011, at 17:41, marc wrote:
>
>> Jan,
>>
>> I had a similar issue where sbt console was not echoing text.  I am not sure if this is your issue, however, comment #5  here fixed the issue for me.
>
>

marc
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: No JLineReader in REPL

Ouch.  Good luck!  If I think of anything else, I will post.

Jan van der Vorst
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

Thanks to you all!

I am sorry to say that none worked for me.
By the way, I am not using SBT so I expect that the problem can not be
caused by the ivy directory.

anyway, thanks again,
Jan van der Vorst

On Jun 2, 9:47 pm, marc wrote:
> Ouch.  Good luck!  If I think of anything else, I will post.

huynhjl 2
Joined: 2011-03-26,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

Hi Jan,

I would recommend to file a bug report with your Windows system
information and the error message.

One more thing you could try is to compile and run the following
program:

object Test extends App {
println(org.fusesource.jansi.internal.WindowsSupport.getConsoleMode)
}

This would cause the dll to be unpacked and loaded. I suspect it will
fail on your system. The stack trace may provide more information than
what the REPL provides. For instance, after I intentionally corrupted
my environment:

C:\code\scala\tmp>\setup\scala\scala-2.9.0.final\bin\scala.bat -cp
classes Test
java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [C:
\code\scala\tmp\jansi.dll: Access is denied, C:\code\scala\tmp
\jansi.dll: Access is denied]
at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:
182)

Assuming you're not the only one to get this error, any extra
information is useful to pinpoint the root cause.

--Jean-Laurent

On Jun 3, 5:36 am, Jan van der Vorst wrote:
> Thanks to you all!
>
> I am sorry to say that none worked for me.
> By the way, I am not using SBT so I expect that the problem can not be
> caused by the ivy directory.
>
> anyway, thanks again,
> Jan van der Vorst
>
> On Jun 2, 9:47 pm, marc wrote:
>
>
>
>
>
>
>
> > Ouch.  Good luck!  If I think of anything else, I will post.

DaveScala
Joined: 2011-03-18,
User offline. Last seen 1 year 21 weeks ago.
Re: No JLineReader in REPL

Have you (double) checked your environment variables? Do you have a
SCALA_HOME environment variable?
Check also your CLASSPATH for other (old) references and remove that.

SCALA_HOME should be C:\scala-2.9.0.1 (or where scala is installed)
and
In PATH there should be %SCALA_HOME%\bin
If this done, scala.bat is automatically adding all lib jars to the
CLASSPATH when startin scala
then class org.fusesource.jansi.internal.Kernel32 should be found in
lib\jline.jar by scala.bat

Jan van der Vorst
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

Hi Jean-Laurent

I did as you proposed and created the object Test. And indeed I got a
more descriptive error message now:

C:\cygwin\home\jv54580\prog\JLine>scala Test
java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no
jansi in java.library.path, C:\WINDOWS\Temp\jansi.d
ll: This application has failed to start because the application
configuration is incorrect. Reinstalling the applicatio
n may fix this problem]
at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:
182)
at org.fusesource.hawtjni.runtime.Library.load(Library.java:
142)
at
org.fusesource.jansi.internal.Kernel32.(Kernel32.java:40)
at
org.fusesource.jansi.internal.WindowsSupport.getConsoleMode(WindowsSupport.java:
48)
at Test$delayedInit$body.apply(jline.scala:2)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV
$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:60)
at scala.App$$anonfun$main$1.apply(App.scala:60)
at scala.collection.LinearSeqOptimized
$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.generic.TraversableForwarder
$class.foreach(TraversableForwarder.scala:30)
at scala.App$class.main(App.scala:60)
at Test$.main(jline.scala:1)
at Test.main(jline.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run
$1.apply(ScalaClassLoader.scala:78)
at scala.tools.nsc.util.ScalaClassLoader
$class.asContext(ScalaClassLoader.scala:24)
at scala.tools.nsc.util.ScalaClassLoader
$URLClassLoader.asContext(ScalaClassLoader.scala:88)
at scala.tools.nsc.util.ScalaClassLoader
$class.run(ScalaClassLoader.scala:78)
at scala.tools.nsc.util.ScalaClassLoader
$URLClassLoader.run(ScalaClassLoader.scala:101)
at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33)
at scala.tools.nsc.ObjectRunner
$.runAndCatch(ObjectRunner.scala:40)
at scala.tools.nsc.MainGenericRunner.runTarget
$1(MainGenericRunner.scala:56)
at
scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
at scala.tools.nsc.MainGenericRunner
$.main(MainGenericRunner.scala:89)
at
scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

I checked whether C:\WINDOWS\Temp\jansi.dll is present, it is.
(By the way, although the prompt suggests otherwise I am running this
in a cmd.exe shell.)

Thanks for your advice.
Jan

On Jun 3, 5:09 pm, huynhjl wrote:
> Hi Jan,
>
> I would recommend to file a bug report with your Windows system
> information and the error message.
>
> One more thing you could try is to compile and run the following
> program:
>
> object Test extends App {
>   println(org.fusesource.jansi.internal.WindowsSupport.getConsoleMode)
>
> }
>
> This would cause the dll to be unpacked and loaded. I suspect it will
> fail on your system. The stack trace may provide more information than
> what the REPL provides. For instance, after I intentionally corrupted
> my environment:
>
> C:\code\scala\tmp>\setup\scala\scala-2.9.0.final\bin\scala.bat -cp
> classes Test
> java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [C:
> \code\scala\tmp\jansi.dll: Access is denied, C:\code\scala\tmp
> \jansi.dll: Access is denied]
>         at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:
> 182)
>
> Assuming you're not the only one to get this error, any extra
> information is useful to pinpoint the root cause.
>
> --Jean-Laurent
>
> On Jun 3, 5:36 am, Jan van der Vorst wrote:
>
>
>
> > Thanks to you all!
>
> > I am sorry to say that none worked for me.
> > By the way, I am not using SBT so I expect that the problem can not be
> > caused by the ivy directory.
>
> > anyway, thanks again,
> > Jan van der Vorst
>
> > On Jun 2, 9:47 pm, marc wrote:
>
> > > Ouch.  Good luck!  If I think of anything else, I will post.- Hide quoted text -
>
> - Show quoted text -

Jan van der Vorst
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

Hi Dave,
I double checked but unfortunately this is not the culprit.
Thanks for your advice,
Jan

On Jun 3, 5:57 pm, Dave wrote:
> Have you (double) checked your environment variables? Do you have a
> SCALA_HOME environment variable?
> Check also your CLASSPATH for other (old) references and remove that.
>
> SCALA_HOME should be C:\scala-2.9.0.1 (or where scala is installed)
> and
> In PATH there should be %SCALA_HOME%\bin
> If this done, scala.bat is automatically adding all lib jars to the
> CLASSPATH when startin scala
> then class org.fusesource.jansi.internal.Kernel32 should be found in
> lib\jline.jar by scala.bat

huynhjl 2
Joined: 2011-03-26,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

Thanks. I don't think that it's likely to be corrupted, but could you
check the md5 on the jansi.dll?

d47102e00a05c357e91988d56ca7a635 *META-INF/native/windows64/jansi.dll
2452a4f2c62c0447948444cfb0f9f428 *META-INF/native/windows32/jansi.dll

A bit of googling suggests that the "This application has failed to
start because the application
configuration is incorrect. Reinstalling the application may fix this
problem" message is usually associated with missing dependencies
http://msdn.microsoft.com/en-us/library/ms235299(v=vs.80).aspx

The following tool http://www.dependencywalker.com/ can help with
finding out which one. On my machine it shows that I have:
- c:\windows\system32\NTDLL.DLL
- c:\windows\system32\KERNEL32.DLL
It also shows I don't have MSVCR90.DLL.

I can't imagine that you would have corrupted NTDLL.DLL or
KERNEL32.DLL and not notice otherwise. May be it's something to do
with the path, once you start scala... Could it be that
java.library.path get's overwritten and c:\windows\system32 is
missing? Try this and see if yield obvious clues.

object Test extends App {
println(System.getProperty("java.library.path"))
println(org.fusesource.jansi.internal.WindowsSupport.getConsoleMode)
}

Other than that I'm out of ideas...

On Jun 4, 1:52 am, Jan van der Vorst wrote:
> Hi Jean-Laurent
>
> I did as you proposed and created the object Test. And indeed I got a
> more descriptive error message now:
>
> C:\cygwin\home\jv54580\prog\JLine>scala Test
> java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no
> jansi in java.library.path, C:\WINDOWS\Temp\jansi.d
> ll: This application has failed to start because the application
> configuration is incorrect. Reinstalling the applicatio
> n may fix this problem]
>         at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:
> 182)
>         at org.fusesource.hawtjni.runtime.Library.load(Library.java:
> 142)
>         at
> org.fusesource.jansi.internal.Kernel32.(Kernel32.java:40)
>         at
> org.fusesource.jansi.internal.WindowsSupport.getConsoleMode(WindowsSupport. java:
> 48)
>         at Test$delayedInit$body.apply(jline.scala:2)
>         at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
>         at scala.runtime.AbstractFunction0.apply$mcV
> $sp(AbstractFunction0.scala:12)
>         at scala.App$$anonfun$main$1.apply(App.scala:60)
>         at scala.App$$anonfun$main$1.apply(App.scala:60)
>         at scala.collection.LinearSeqOptimized
> $class.foreach(LinearSeqOptimized.scala:59)
>         at scala.collection.immutable.List.foreach(List.scala:45)
>         at scala.collection.generic.TraversableForwarder
> $class.foreach(TraversableForwarder.scala:30)
>         at scala.App$class.main(App.scala:60)
>         at Test$.main(jline.scala:1)
>         at Test.main(jline.scala)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:
> 25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run
> $1.apply(ScalaClassLoader.scala:78)
>         at scala.tools.nsc.util.ScalaClassLoader
> $class.asContext(ScalaClassLoader.scala:24)
>         at scala.tools.nsc.util.ScalaClassLoader
> $URLClassLoader.asContext(ScalaClassLoader.scala:88)
>         at scala.tools.nsc.util.ScalaClassLoader
> $class.run(ScalaClassLoader.scala:78)
>         at scala.tools.nsc.util.ScalaClassLoader
> $URLClassLoader.run(ScalaClassLoader.scala:101)
>         at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33)
>         at scala.tools.nsc.ObjectRunner
> $.runAndCatch(ObjectRunner.scala:40)
>         at scala.tools.nsc.MainGenericRunner.runTarget
> $1(MainGenericRunner.scala:56)
>         at
> scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
>         at scala.tools.nsc.MainGenericRunner
> $.main(MainGenericRunner.scala:89)
>         at
> scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
>
> I checked whether C:\WINDOWS\Temp\jansi.dll is present, it is.
> (By the way, although the prompt suggests otherwise I am running this
> in a cmd.exe shell.)
>
> Thanks for your advice.
> Jan
>
> On Jun 3, 5:09 pm, huynhjl wrote:
>
>
>
>
>
>
>
> > Hi Jan,
>
> > I would recommend to file a bug report with your Windows system
> > information and the error message.
>
> > One more thing you could try is to compile and run the following
> > program:
>
> > object Test extends App {
> >   println(org.fusesource.jansi.internal.WindowsSupport.getConsoleMode)
>
> > }
>
> > This would cause the dll to be unpacked and loaded. I suspect it will
> > fail on your system. The stack trace may provide more information than
> > what the REPL provides. For instance, after I intentionally corrupted
> > my environment:
>
> > C:\code\scala\tmp>\setup\scala\scala-2.9.0.final\bin\scala.bat -cp
> > classes Test
> > java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [C:
> > \code\scala\tmp\jansi.dll: Access is denied, C:\code\scala\tmp
> > \jansi.dll: Access is denied]
> >         at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:
> > 182)
>
> > Assuming you're not the only one to get this error, any extra
> > information is useful to pinpoint the root cause.
>
> > --Jean-Laurent
>
> > On Jun 3, 5:36 am, Jan van der Vorst wrote:
>
> > > Thanks to you all!
>
> > > I am sorry to say that none worked for me.
> > > By the way, I am not using SBT so I expect that the problem can not be
> > > caused by the ivy directory.
>
> > > anyway, thanks again,
> > > Jan van der Vorst
>
> > > On Jun 2, 9:47 pm, marc wrote:
>
> > > > Ouch.  Good luck!  If I think of anything else, I will post.- Hide quoted text -
>
> > - Show quoted text -

Jan van der Vorst
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

> 2452a4f2c62c0447948444cfb0f9f428 *META-INF/native/windows32/jansi.dll
md5 matches.

> It also shows I don't have MSVCR90.DLL.
I get an error message regarding a missing MSVCR90.DLL
I presume you also got that message, but in your case this does not
lead to a problem with the JLineReader right?

> missing? Try this and see if yield obvious clues.
> ...
I do not see anything special; c:\windows\system32 is in.

> Other than that I'm out of ideas...
Thanks for putting in your time, you showed me some interesting
tricks.
Jan

Jan van der Vorst
Joined: 2011-06-02,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

Gotcha!
Problem solved by installing the MS VC++ Runtime libraries from
http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=A5C8427...
which contains msvcr90.dll

many thanks to Jean-Laurent!
Jan

On Jun 5, 12:15 pm, Jan van der Vorst wrote:
> > 2452a4f2c62c0447948444cfb0f9f428 *META-INF/native/windows32/jansi.dll
>
> md5 matches.
>
> > It also shows I don't have MSVCR90.DLL.
>
> I get an error message regarding a missing MSVCR90.DLL
> I presume you also got that message, but in your case this does not
> lead to a problem with the JLineReader right?
>
> > missing? Try this and see if yield obvious clues.
> > ...
>
> I do not see anything special; c:\windows\system32 is in.
>
> > Other than that I'm out of ideas...
>
> Thanks for putting in your time, you showed me some interesting
> tricks.
> Jan

huynhjl 2
Joined: 2011-03-26,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

> > It also shows I don't have MSVCR90.DLL.
>
> I get an error message regarding a missing MSVCR90.DLL
> I presume you also got that message, but in your case this does not
> lead to a problem with the JLineReader right?

Correct. I'm not in front of the right computer to check my setup but
I found a pretty good read here: http://www.davidlenihan.com/2007/07/winsxs.html

I would give a shot at installing vcredist_x86.exe (or
vcredist_x64.exe).

http://www.microsoft.com/downloads/en/details.aspx?familyid=A5C84275-3B9...
http://www.microsoft.com/downloads/en/details.aspx?familyid=BA9257CA-337...

On Jun 5, 3:15 am, Jan van der Vorst wrote:
> > 2452a4f2c62c0447948444cfb0f9f428 *META-INF/native/windows32/jansi.dll
>
> md5 matches.
>
> > It also shows I don't have MSVCR90.DLL.
>
> I get an error message regarding a missing MSVCR90.DLL
> I presume you also got that message, but in your case this does not
> lead to a problem with the JLineReader right?
>
> > missing? Try this and see if yield obvious clues.
> > ...
>
> I do not see anything special; c:\windows\system32 is in.
>
> > Other than that I'm out of ideas...
>
> Thanks for putting in your time, you showed me some interesting
> tricks.
> Jan

huynhjl 2
Joined: 2011-03-26,
User offline. Last seen 42 years 45 weeks ago.
Re: No JLineReader in REPL

Awesome! I learned a few things myself and I'm glad that it wasn't in
vain.

On Jun 5, 5:01 am, Jan van der Vorst wrote:
> Gotcha!
> Problem solved by installing the MS VC++ Runtime libraries fromhttp://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=A5C8...
> which contains msvcr90.dll
>
> many thanks to Jean-Laurent!
> Jan
>
> On Jun 5, 12:15 pm, Jan van der Vorst wrote:
>
>
>
>
>
>
>
> > > 2452a4f2c62c0447948444cfb0f9f428 *META-INF/native/windows32/jansi.dll
>
> > md5 matches.
>
> > > It also shows I don't have MSVCR90.DLL.
>
> > I get an error message regarding a missing MSVCR90.DLL
> > I presume you also got that message, but in your case this does not
> > lead to a problem with the JLineReader right?
>
> > > missing? Try this and see if yield obvious clues.
> > > ...
>
> > I do not see anything special; c:\windows\system32 is in.
>
> > > Other than that I'm out of ideas...
>
> > Thanks for putting in your time, you showed me some interesting
> > tricks.
> > Jan

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland