Newbie Help: findMatchingCallableForArgs error

I’m unable to get a simple ruby script to work that makes use of a Java
class and could use some assistance. I’ve read all through the wiki and
tried some googling, but no luck.

JRuby Version:
jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot™ 64-Bit
Server VM 1.7.0_09-b05 [darwin-x86_64]

Java Version:
java version “1.7.0_09”
Java™ SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot™ 64-Bit Server VM (build 23.5-b02, mixed mode)

I’m trying to create a super simple ruby script that interfaces with the
Stanford NLP Parser (Java). For now I’m just trying to recreate, in
Ruby, a the first line from their Java demo. I’ve run the demo and it
runs fine. Here is a snippet of the Java code:

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import edu.stanford.nlp.objectbank.TokenizerFactory;
import edu.stanford.nlp.process.CoreLabelTokenFactory;
import edu.stanford.nlp.process.DocumentPreprocessor;
import edu.stanford.nlp.process.PTBTokenizer;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.HasWord;
import edu.stanford.nlp.ling.Sentence;
import edu.stanford.nlp.trees.*;
import edu.stanford.nlp.parser.lexparser.LexicalizedParser;

class ParserDemo {

public static void main(String[] args) {
LexicalizedParser lp =

Here is my simple jruby script:

require ‘./stanford-parser.jar’
require ‘./stanford-parser-models.jar’

java_import “edu.stanford.nlp.parser.lexparser.LexicalizedParser”

lp =
puts “Done”

I get this error. Any help is appreciated. findMatchingCallableForArgs': java.lang.ArrayIndexOutOfBoundsException: 2 from’
from findCallable' from’
from call' from’
from call' from blah.rb:6:infile
from blah.rb:-1:in load' from’
from runScript' from’
from runFromMain' from’
from internalRun' from’
from run' from’


Sorry, meant to post that to the JRuby forum. Please disregard.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs