Skip to main content

How to get Scala working with the RXVT terminal on Cygwin

Out of the box Scala support Cygwin, but this is only with the Windows command prompt-based bash terminal. If you have opted for the more UNIX-like terminal of RXVT then you will find that although the interactive Scala interpreter runs, you can't get it to do anything!

This has been raised as a bug (Ticket #2097) against the Scala project and graehl even posted a patch to changed the generation of the scala runtime scripts.  As my Scala install was based on the downloaded Windows binaries (scala-2.7.6.final.zip) I couldn't directly use this patch, but I could examine it to see what graehl's fix was.

It appears that the key bit was to add the following Java command line option to the java statement that starts the scala interactive interpreter:
-Djline.terminal=jline.UnixTerminal
So the last line of my bin/scala file is:
exec "${JAVACMD:=java}" $JAVA_OPTS -cp "$TOOL_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLASSPATH" -Denv.emacs="$EMACS" -Djline.terminal=jline.UnixTerminal scala.tools.nsc.MainGenericRunner  "$@"
This appears to work, my interactive environment is now interactive!

Technorati Tags: , , ,

Comments

Christoph said…
Hi,

very helpful :-) Now my putty-cygwin-combination works fine even with Scala. Thanks!
Andrew Beacock said…
Christoph, No problem, glad you found it helpful!
Unknown said…
Andrew, you're a hero -- just what I needed. Thanks!
Unknown said…
Good bug finding dude.
Scala console still needs a bit of work to get as good as Python, no code completion for starters.

Shame the maintainer seems to be a bit of a noob. Check out the last comment on the ticket.

http://lampsvn.epfl.ch/trac/scala/ticket/2097

And I'd consider myself a "serious" OS/Linux user.

Think.
Unknown said…
I followed your instructions and expanded them a little to get a nicely working env.

http://sentimentalbryan.blogspot.com/2010/09/cygwin-scala-windows-7.html
Anonymous said…
Than you for posting this. I probably would not have solved this myself.