-
Notifications
You must be signed in to change notification settings - Fork 0
rakk/jrubyandjavainterface
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
JRuby classes generated by "jrubyc" are different that generated by "jrubyc --javac". If you want to implement Java inteface in JRuby use "jrubyc --javac" command instead of "jrubyc". [1 case] jrubyc --javac: public class SimpleImplementation extends RubyObject implements SimpleJavaInterface { (...) } [2 case] jrubyc: public class SimpleImplementation extends AbstractScript { (...) } [2 case] generete error: "incompatible types" for code: SimpleJavaInterface sji = new SimpleImplementation(); ===================================================== how to run code: ===================================================== update variables in run.sh bash run.sh ... output: ===================================================== jruby jar: [/home/rakk/.m2/repository/org/jruby/jruby/1.6.0/jruby-1.6.0.jar] ===================================================== ===================================================== jrubyc --javac ===================================================== ...............compile SimpleImplementation.rb Generating Java class SimpleImplementation to output_jrubyc_with_javac/SimpleImplementation.java javac -d output_jrubyc_with_javac -cp /home/rakk/dev/bin/langs/jruby/lib/jruby.jar:SimpleJavaInterface-1.0.jar:/home/rakk/.m2/repository/org/jruby/jruby/1.6.0/jruby-1.6.0.jar:. output_jrubyc_with_javac/SimpleImplementation.java ...............we get... output_jrubyc_with_javac/SimpleImplementation.java (...) public class SimpleImplementation extends RubyObject implements SimpleJavaInterface { private static final Ruby __ruby__ = Ruby.getGlobalRuntime(); private static final RubyClass __metaclass__; (...) output_jrubyc_with_javac/SimpleImplementation.class (...) public class SimpleImplementation extends RubyObject implements SimpleJavaInterface { private SimpleImplementation(Ruby ruby, RubyClass rubyclass) (...) ===================================================== jrubyc --java ===================================================== ...............compile SimpleImplementation.rb Generating Java class SimpleImplementation to output_jrubyc_with_java/SimpleImplementation.java ...............we get... output_jrubyc_with_java/SimpleImplementation.java: (...) public class SimpleImplementation extends RubyObject implements SimpleJavaInterface { private static final Ruby __ruby__ = Ruby.getGlobalRuntime(); private static final RubyClass __metaclass__; (...) ===================================================== jrubyc ===================================================== ...............compile SimpleImplementation.rb Compiling SimpleImplementation.rb to class SimpleImplementation ...............we get... output_jrubyc/SimpleImplementation.class: (...) import org.jruby.runtime.*; import org.jruby.runtime.builtin.IRubyObject; public class SimpleImplementation extends AbstractScript { private static void setPosition(ThreadContext threadcontext, int i) { threadcontext.setFileAndLine("SimpleImplementation.rb", i); (...)
About
jruby class implements java interface test
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published