jruby-java-interop

Java Reflection: Determining class of java.util.regex.Pattern in JRuby

删除回忆录丶 提交于 2019-12-24 01:21:57
问题 Working on a legacy JRuby app (1.6.8) running under Java 11, I traced a peculiar error a test case: "require 'java'; puts java::util::regex::Pattern.class" errors ArgumentError: wrong number of arguments (0 for 1) . For other built-in JRE classes, this seems to work fine (see below). This causes JRuby itself to fail sometimes, at this line in https://github.com/jruby/jruby/blob/1.6.8/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/object.rb#L10 : if self.class.superclass.instance

org.jruby.embed.EvalFailedException: (LoadError) no such file to load

﹥>﹥吖頭↗ 提交于 2019-12-11 14:56:09
问题 I've created jar file from ruby code using warbler. File structure within jar is as below: core.jar ----core --------lib ------------gui.class ------------gui.rb I've other java application from which I want to run "connect" function which is in Gui class of gui.rb. I've tried below code in java: ScriptingContainer SCRIPTING_CONTAINER = new ScriptingContainer; // String CORE_JAR_PATH = "core.jar"; String CORE_JAR_PATH = "core.jar!/core/lib"; SCRIPTING_CONTAINER.getLoadPaths().add(CORE_JAR