Hi all,
I'm using jruby 1.6.7, rawr 1.6.3 and JDK 7 on my Windows 7 pc.
I tried the following:
C:\tmp\hello>ls
main.rb
C:\tmp\hello>cat main.rb
h = {:a => 1, :b => 2}
p h
C:\tmp\hello>jruby --1.9 -S rawr install
(omit output messages)
Edit line 65 in build_configuration.rb:
c.target_jvm_version = 1.7
C:\tmp\hello>jruby --1.9 -S rake rawr:jar
(omit output messages)
C:\tmp\hello>java -jar package\jar\hello.jar
{:a=>1, :b=>2}
Yeah, it works very well!
But after replaced the first line of main.rb like this:
h = {a: 1, b: 2}
I got the following syntax error:
C:\tmp\hello>java -jar package\jar\hello.jar
Exception in thread "main" org.jruby.exceptions.RaiseException:
(SyntaxError) ./
main.rb:1: syntax error, unexpected ':'
h = {a: 1, b: 2}
^
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033)
at (Anonymous).(root)(./main.rb:1)
Umm,...
Does anyone know how to run jruby-complete.jar with 1.9 mode?
ashbb
on 2012-04-21 06:27
on 2012-04-21 18:58
On Fri, Apr 20, 2012 at 11:27 PM, ashbb shoeser <lists@ruby-forum.com> wrote: > Hi all, > > I'm using jruby 1.6.7, rawr 1.6.3 and JDK 7 on my Windows 7 pc. [...] > Umm,... > Does anyone know how to run jruby-complete.jar with 1.9 mode? I haven't tested this out, but try this: Look in your rawr project's src/org/rubyforge/raw/Main.java. Before the line: Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(0), config); paste this: System.setProperty("jruby.compat.version", org.jruby.CompatVersion.RUBY1_9.toString());
on 2012-04-23 12:48
Hi Ashbb, We found a similar issue when compiling with warbler when invoking with jruby-complete.jar. The command line arguments are not propagated to the process that invokes jrubyc, so it always runs in the default (1.8) mode. We patched warbler to send --1.9 to jrubyc when invoked in 1.9 mode, so you might need to do the same thing for rawr. I see it uses a slightly different mechanism for calling jrubyc, but it looks like that method can also take additional arguments, like the --1.9 flag (in the file lib/rawr/jruby_batch_compiler.rb). I think that jruby-1.7 will default to 1.9 mode, but then the people needing 1.8 mode will encounter the same grief :( Regards, Michael
on 2012-04-26 13:45
Hi Eric,
Thank you for the information. Sorry for this late reply.
I tried your suggestion, but umm,... got the same error...
But I tried the following. It worked!
C:\tmp\hello>java -Djruby.compat.version=RUBY1_9 -jar
package\jar\lib\java\jruby-complete.jar main.rb
{:a=>1, :b=>2}
Thanks to your information, I got a solution, not using rawr, though.
:-P
ashbb
on 2012-04-26 14:01
Hi Michael, Thank you for the reply. Sorry for this late reply. > We patched warbler to send --1.9 to jrubyc when invoked in 1.9 mode, so > you might need to do the same thing for rawr. You are right. I'd like to improve rawr to run in 1.9 mode. But I've no skill. :( > I think that jruby-1.7 will default to 1.9 mode Wow, cool! > but then the people needing 1.8 mode will encounter the same grief :( hahaha. True! But can't wait to use jruby-1.7!! ashbb
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
Log in with Google account | Log in with Yahoo account
No account? Register here.