What is the correct syntax for this in jruby 1.6.8?

I am trying to make use of this file with the jruby-jars 1.6.8

but I would get syntax error around line 45 of the above file

The following is the error that I would get. What is the correct syntax
for jruby 1.6.8? I know that this file works in jruby 1.7.0 (jruby-jars
1.7.0 http://rubygems.org/gems/jruby-jars)

application initialization failed:
/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/gems/gems/open_nlp-0.0.5-java/lib/open_nlp/parser/parse.rb:45:
syntax error, unexpected ‘:’

data = {type: kid.getType, parent_type: self.j_instance.getType,
token: kid.toString}
^
from org/jruby/RubyKernel.java:1062:in require' from file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-stdlib-1.6.8.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire’
from
/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/gems/gems/open_nlp-0.0.5-java/lib/open_nlp/parser/parse.rb:28:in
(root)' from org/jruby/RubyKernel.java:1062:inrequire’
from
file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-stdlib-1.6.8.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:60:in
require' from file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-stdlib-1.6.8.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:inrequire’
from
/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/gems/gems/open_nlp-0.0.5-java/lib/open_nlp.rb:4:in
load_settings_from_init_rb' from org/jruby/RubyKernel.java:1112:ineval’
from
file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/booter.rb:127:in
load_settings_from_init_rb' from org/jruby/RubyArray.java:1620:ineach’
from
file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/booter.rb:115:in
load_settings_from_init_rb' from file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/booter.rb:30:inboot!’
from
file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/boot/rack.rb:10:in
(root)' from org/jruby/RubyKernel.java:1087:inload’
from
file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/boot/ra

Hi,

Le 30/10/2012 20:00, joyce chan a écrit :

I am trying to make use of this file with the jruby-jars 1.6.8

https://github.com/hck/open_nlp/blob/master/lib/open_nlp/parser/parse.rb

but I would get syntax error around line 45 of the above file

The following is the error that I would get. What is the correct syntax
for jruby 1.6.8? I know that this file works in jruby 1.7.0 (jruby-jars
1.7.0 http://rubygems.org/gems/jruby-jars)

1.6.8 defaults to ruby 1.8.7, whilst 1.7.0 default to ruby 1.9.3.
The syntax you are using is 1.9-specific, so try:

data = { :type => kid.getType, :parent_type => self.j_instance.getType,
:token => kid.toString }

Regards,
Sébastien.

…or she can start JRuby version (< 1.7) with the --1.9 option, no?..

…by putting “–1.9” in the JRUBY_OPTS environment variable, or
specifying “–1.9” on a JRuby command line?

  • Keith

Hi,

Le 30/10/2012 21:15, Keith B. a

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