If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Sunday, December 9, 2012

Getting Git Bash and Scala working on windows

I found a great blog post about fixing issues. I already avoid using spaces in directory names so I only ran into the last issue:
nxp10009@NXL01366 /c/development/scala/scala-2.9.2/bin
$ scala
Exception in thread "main" java.lang.NoClassDefFoundError: scala/tools/nsc/MainGenericRunner
Caused by: java.lang.ClassNotFoundException: scala.tools.nsc.MainGenericRunner
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: scala.tools.nsc.MainGenericRunner.  Program will exit.

So I only need to create a bash script and add an alias to fix the issue
nxp10009@NXL01366 ~
$ cd ~

nxp10009@NXL01366 ~
$ pwd
/c/Users/nxp10009

nxp10009@NXL01366 ~
$ vi .bashrc

alias scala='scala -nobootcp'

Now exit Git Bash and open a new shell:
nxp10009@NXL01366 ~
$ scala
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_32).
Type in expressions to have them evaluated.
Type :help for more information.

scala>

No comments:

Post a Comment