Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting JRuby to work in RubyMine

I setup the proper SDK because all my ruby code will compile but RubyMine complains that it can't find the any of my java classes? Is this a flaw or is there a way to get it to recognizewhere the classes are?

Here is my code, I have underlined all the things its complaining about

require 'java'

include_class 'java.awt.event.ActionListener'
include_class 'javax.swing.JButton'
include_class 'javax.swing.JFrame'

class ClickAction
  include ActionListener

  def action_performed(event)
    puts "Button got clicked."
  end
end

Is there a way around this because I'd love to buy RubyMine if it's able to inform me of what Java classes and methods I can pick from. Thanks

like image 985
Matthew Stopa Avatar asked May 04 '10 00:05

Matthew Stopa


People also ask

How does JRuby work?

JRuby is designed to work as a mixed-mode virtual machine for Ruby, where code can be either interpreted directly, just-in-time compiled at runtime to Java bytecode, or ahead-of-time compiled to Java bytecode before execution.

Is IntelliJ good for Ruby?

IntelliJ IDEA supports the reference implementation of Ruby (Ruby MRI) and alternative implementations, such as JRuby or TruffleRuby. Before installing the Ruby interpreter, you need to install the dependencies required to compile Ruby on your machine.


1 Answers

RubyMine does not have any support for Java and does not recognize Java classes - JRuby is only supported as a target platform for running regular Ruby code. Full Java/Ruby interoperability is supported in IntelliJ IDEA with the Ruby plugin.

like image 158
yole Avatar answered Oct 21 '22 04:10

yole