Forum: JRuby Jruby "RuntimeHelpers" class is depricated.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0ceaeac81e3241b52e458e21107a974a?d=identicon&s=25 Amol Gaikwad (agaikwad)
on 2016-06-06 11:58
I am having a project based on JRuby on rails, now I am migrating this
project to jruby-9.0.5.0 version.

In the code, ruby is called from Java file as shown below:

 String source = new StringBuilder("require 'java'\n" +
        "\n" +
        "java_package 'jrubysource'\n" +

        "class SystemFilePath\n" +
        "  attr_accessor :topDirCmd, :topDirNames\n" +
        "  java_signature 'SystemFilePath(String topDirCmd)'\n" +
        "  def initialize(topDirCmd)\n" +
        "    @topDirCmd = topDirCmd\n" +
        "    setTopDirectoryNames()\n" +
        "  end\n" +
        "\n" +
        "  java_signature 'void setTopDirectoryNames()'\n" +
        "  def setTopDirectoryNames\n" +
        "    Open3.popen3(@topDirCmd) { |stdin, stdout, stderr,
wait_thread|\n" +
        "      out = stdout.read\n" +
        "      err = stderr.read\n" +
        "      if err.size > 0 || out.size == 0\n" +
        "        @topDirNames = nil\n" +
        "        return\n" +
        "      end\n" +
        "      out = out.split(/\\n/).select{|a| a.match(/system_1/) &&
!a.match(/system_1\\/sim/)}.join(\"\\n\") + \"\\n\";\n" +
        "      topDirNames = out.split(/\\//).select{|a| a.match(/\\n$/)
}.map(&:chomp)\n" +
        "      if topDirNames.size == 0 then\n" +
        "        @topDirNames = nil\n" +
        "        return\n" +
        "      end\n" +
        "      @topDirNames = topDirNames.sort.reverse\n" +
        "    }\n" +
        "  rescue Exception => e\n" +
        "    @topDirNames = nil\n" +
        "  end\n" +
        "\n" +
        "end\n" +
        "").toString();
    __ruby__.executeScript(source, "system_file_path.rb");
    RubyClass metaclass = __ruby__.getClass("SystemFilePath");
    metaclass.setRubyStaticAllocator(SystemFilePath.class);
    if (metaclass == null) throw new NoClassDefFoundError("Could not
load Ruby class: SystemFilePath");
    __metaclass__ = metaclass;


public void setTopDirectoryNames() {
    @SuppressWarnings("unused")
    IRubyObject ruby_result =
RuntimeHelpers.invoke(__ruby__.getCurrentContext(), this,
"setTopDirectoryNames"); //Here i am calling ruby code from java file.
        return;
}


Now, according to a JRuby API document "RuntimeHelpers" class is
deprecated.

The document provides no alternative API. Please guide me towards an
alternative as this is a blocker for me.
This topic is locked and can not be replied to.