Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't write to java.lang.System.out in java 11 #5819

Closed
cshupp1 opened this issue Aug 8, 2019 · 4 comments

Comments

@cshupp1
Copy link

commented Aug 8, 2019

Consider the following irb session on Windows 10:

c:\languages\Java\jdk1.8.0_121\bin\java.exe -jar %JRUBY_JAR% -S irb
irb(main):007:0> JRUBY_VERSION
=> "9.2.7.0"
irb(main):003:0> Java::JavaLang::System.out
=> #<Java::JavaIo::PrintStream:0x483b0690>
irb(main):004:0> java.lang.System.out
=> #<Java::JavaIo::PrintStream:0x483b0690>
irb(main):005:0> java.lang.System.out
=> #<Java::JavaIo::PrintStream:0x483b0690>
irb(main):006:0> java.lang.System::out
=> #<Java::JavaIo::PrintStream:0x483b0690>

All of these works so, as expected, I can do:

irb(main):008:0> java.lang.System.out.println("I love JRuby")
I love JRuby

Let's try java 11:

C:\work\uts-web\uts-web-editor>irb
irb(main):001:0> JRUBY_VERSION
=> "9.2.7.0"
irb(main):003:0> java.lang.System.getProperty('java.version')
=> "11.0.4"
irb(main):004:0> java.lang.System.out
?[1mTraceback?[m (most recent call last):
        7: from C:/languages/ruby/jruby-9.2.7.0/bin/jirb:13:in `<main>'
        6: from org/jruby/RubyKernel.java:1193:in `catch'
        5: from org/jruby/RubyKernel.java:1193:in `catch'
        4: from org/jruby/RubyKernel.java:1425:in `loop'
        3: from org/jruby/RubyKernel.java:1061:in `eval'
        2: from (irb):4:in `evaluate'
        1: from org/jruby/RubyBasicObject.java:1708:in `method_missing'
?[1mNoMethodError (?[4mundefined method `out' for Java::JavaLang::System:Class?[0;1m)?[m
?[1mDid you mean?  out=?[m

All the previous attempted syntaxes also fail.

@cshupp1

This comment has been minimized.

Copy link
Author

commented Aug 8, 2019

irb(main):007:0> java.lang.System.java_class.field(:out).value(nil).println("I love JRuby")
I love JRuby
=> nil

That does work btw.

@enebo enebo modified the milestone: JRuby 9.2.8.0 Aug 8, 2019

@enebo

This comment has been minimized.

Copy link
Member

commented Aug 8, 2019

Yeah this appears to be working on 11 now:

irb(main):001:0> java.lang.System.out
=> #<Java::JavaIo::PrintStream:0x5b5b53c6>
irb(main):002:0> java.lang.System.out.println("HEH")
HEH
=> nil

@enebo enebo closed this Aug 8, 2019

@cshupp1

This comment has been minimized.

Copy link
Author

commented Aug 8, 2019

When is 9.2.8 being released? @enebo

@enebo

This comment has been minimized.

Copy link
Member

commented Aug 8, 2019

@cshupp1 we are hoping monday. Just making sure we have everything landed we intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.