I am trying to implement the pearl of the Ruby Java Bridge (RJB) to talk with the JVM so that I can launch the Open-NLP stone. I have Java installed and running on Windows 8. All indications, at least I know, is that Java is installed and running. But attempts to crash RJB with the message "cannot create a Java VM." (Sometimes I get the undefined `dlopen 'method for Fiddle: Module" in other cases, which also cannot be parsed.)
At first I just installed the JDK by default. Due to my 64-bit system, this installed 64-bit Java. I was not sure whether Ruby and RJB would talk about this, so I installed a 32-bit JRE. However, the error is the same.
Is there any additional test I can run to ensure that the JVM runs outside of Ruby?
Can someone tell me what I need to do to run Windows / Ruby / RJB / JVM?
Thanks...
I am running Windows 8 with BitNami Rubystack and Ruby 1.9.3p448.
Java seems to be available according to testjava.jsp:
This is the code, including the url where I found it:
class FiddleTry # http://devjete.wordpress.com/2011/01/31/installing-rjb-1-3-4-on-windows-7-32bit-wo-vc/ require 'rjb' out = Rjb::import('java.lang.System').out <== Line 5 is here out.print('Hello Rjb from ') p out._classname end
Here are the error messages:
C:/Users/Richard/RubymineProjects/Utilities/fiddle_try.rb:5:in `import': can't create Java VM (RuntimeError) from C:/Users/Richard/RubymineProjects/Utilities/fiddle_try.rb:5:in `<class:FiddleTry>' from C:/Users/Richard/RubymineProjects/Utilities/fiddle_try.rb:1:in `<top (required)>' from -e:1:in `load' from -e:1:in `<main>'
I cannot find any further information on why "it is impossible to create a Java VM." It would really help if additional information was available to me. I would appreciate this information or this. Thanks...
EDIT TO ADD INFORMATION REGARDING THE REQUIREMENT OF OPEN NLP FOR RJB ...
This is the code I'm trying to run, taken from Github / Open-nlp:
class OpenNlpSample ENV['JAVA_HOME'] = "C:/Program Files/Java/jdk1.7.0_25" if ENV['JAVA_HOME'].nil? ENV['LD_LIBRARY_PATH'] = "C:/Program Files/Java/jdk1.7.0_25/bin; C:/Program Files (x86)/Java/jre7" if ENV['LD_LIBRARY_PATH'].nil?
At this point in the code:
=begin Examples Simple tokenizer =end OpenNLP.load
The call chain is dl.rb, fiddle.rb and jar_loader.rb. jarloader.rb start line 43:
# Load Rjb and create Java VM. def self.init_rjb ::Rjb::load(nil, self.jvm_args) set_java_logging if self.log_file end
At this moment, I get the same error when creating the JVM. So, I returned to trying to start RJB. The error chain is as follows:
Fast Debugger (ruby-debug-ide 0.4.17, ruby-debug-base19x 0.11.30.pre12) listens on 127.0.0.1:59488 Uncaught exception: can't create Java VM D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/jar_loader.rb:45:in `load' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/jar_loader.rb:45:in `init_rjb' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/jar_loader.rb:38:in `load_jar_rjb' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/jar_loader.rb:27:in `load' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:63:in `load_jar' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:71:in `block in load_default_jars' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:68:in `each' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:68:in `load_default_jars' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:55:in `bind' D:/BitNami/rubystack-1.9.3-12/ruby/lib/ruby/gems/1.9.1/gems/open-nlp-0.1.4/lib/open-nlp.rb:14:in `load' C:/Users/Richard/RubymineProjects/Utilities/open_nlp_sample.rb:32:in `<class:OpenNlpSample>' C:/Users/Richard/RubymineProjects/Utilities/open_nlp_sample.rb:1:in `<top (required)>'