Skip to content
louismullie edited this page Dec 26, 2012 · 2 revisions

This page is about common issues that users may encounter when trying to setup the stanford-core-nlp gem.

Can't Build Rjb

You need to make sure that Rjb can access the Java library. This is done by setting JAVA_HOME in your terminal. For example, on Ubuntu:

export "JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386"

Can't Create Java VM

This means that the Java virtual machine (VM) cannot be created. This could be due to an insufficient amount of RAM available to launch the VM (by default, the gem will as for up to 1024MB of RAM). Try the following before running the application (uses a maximum of 256 MB of RAM):

export JAVA_OPTS="-Xmx128m -Xms128m -XX:MaxPermSize=128m"

File Input/Output Exceptions

Example 1:

RuntimeError: Could not find JAR file (looking in joda-time.jar).

Example 2:

Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ...
java.io.IOException: Unable to resolve "edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz" as either class path, filename or URL

Example 3:

Loading classifier from /Users/thomas/edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ...
java.io.FileNotFoundException: edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz

This problem occurs when a JAR or model file supplied to the Core NLP library cannot be found. Check that the model file exists relative to the variables StanfordCoreNLP.jar_path or StanfordCoreNLP.model_path, respectively.

Bad version number in .class file error

This error was reported by a user who was trying to run the gem within a Rails application. The solution was to set JAVA home inside environment.rb:

ENV['JAVA_HOME'] = "/path/to/java/"
Clone this wiki locally