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 ( 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:
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  "$@"
This appears to work, my interactive environment is now interactive!

Technorati Tags: , , ,


Christoph said…

very helpful :-) Now my putty-cygwin-combination works fine even with Scala. Thanks!
Andy B said…
Christoph, No problem, glad you found it helpful!
Nicholas said…
Andrew, you're a hero -- just what I needed. Thanks!
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.

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

I followed your instructions and expanded them a little to get a nicely working env.
David said…
Than you for posting this. I probably would not have solved this myself.