Forum: JRuby What is the correct syntax for this in jruby 1.6.8?

Posted by Joyce Chan (jchan)
on 2012-10-30 21:01
(Received via mailing list)
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/op...

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:in
`require'
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: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: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:in
`require'
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:in `eval'
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:in `each'
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:in
`boot!'
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:in `load'
from 
file:/opt/apache-tomcat/webapps/tagsuggest/WEB-INF/lib/jruby-rack-1.1.10.jar!/jruby/rack/boot/ra
Posted by "Sébastien Le Callonnec" <slc_ie@yahoo.ie> (Guest)
on 2012-10-30 21:13
(Received via mailing list)
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/op...
>
> 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.
Posted by Keith B. (keith_b)
on 2012-10-30 22:16
(Received via mailing list)
...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
Posted by "Sébastien Le Callonnec" <slc_ie@yahoo.ie> (Guest)
on 2012-10-30 23:06
(Received via mailing list)
Hi,

Le 30/10/2012 21:15, Keith Bennett a
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.