Tuesday, January 22, 2013

Yes I'm still working on stuff....

Jruby, why you so silly.....

I'll keep this simple. In my attempts to use jruby on my freshly installed windows system to communicate with the msp430 over serial, I ran into an issue. Jruby didn't want to run even though it ran fine on my previous install. This was of course an updated version and from searching and reading, I wasn't the only one.  I didn't seem to find a solution to my problem(at least one that didn't involve dling and installing the jdk which I didn't want to do at the time), and in fact had to find the solution on my own.

The Problem: jruby doesn't want to run my .rb files, instead it complains about the lack of a path in JAVA_HOME.
The full error: "Cannot locate Java installation, specified by JAVA_HOME:"
Observation: 
  • jruby -v seems to work fine...
  • jruby myfile.rb doesn't work(fails in IDE as well). 
  • jruby --help works...hmmm...?
  • jruby -v myfile.rb works....really??
So do I need to pass a param to get it to work? Yup!
I don't want to pass something silly like -v every time I want to run a ruby script so the next best thing is to force the version by using --1.9
So "jruby --1.9 myfile.rb" works.

Annoying, yes, but solves at least one of my problems....next, get serialport gem working on the windows side if possible...
I'm still fairly new to using jruby, so maybe this is something that I'm just not familiar with...

EDIT:
After further investigating changing the following values appears to resolve most of the other issues I was running into.
Remove JAVA_HOME env variable completely
set JAVACMD to use c:\jruby-1.7.2\jre\bin\java.exe