How to run tk programs in RubyMine

I can run from the Ubuntu command line;

ruby hello.rb and it works but trying to run it in RubyMine gives an error:

/usr/local/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/rleblanc/RubymineProjects/hello/hello.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- tk (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /home/rleblanc/RubymineProjects/hello/hello.rb:2:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

Process finished with exit code 1

How do I setup RubyMine so it can't find whatever it is it can't seem to find to run this?


require 'tk'
   hello = do
     title "Hello World"
     # the min size of window
   end do
     text 'Hello World'
     foreground 'red'
    pack { padx 15; pady 15; side 'left'}

Comment actions Permalink

Hello Rich,

Could you please try to launch the same command line, generated by RubyMine automatically, within the terminal?


Comment actions Permalink

Sorry, I don't understand what you mean. The command line was "ruby hello.rb" from a terminal window in Ubuntu. What do you mean "generated by RubyMine automatically"? What generated? A terminal window? a command line? I don't inderstand.

I have a little more info. It turns out that the script works with ruby 1.8 just not ruby 1.9 which is what is set to use in RubyMine. I guess I need to get ruby 1.8 and 1.9 both working at the same time. Is that possible or even a good idea? Or should I just upgrade everything to 1.9? It seems that having the two differents versions causes problems.

Comment actions Permalink

Sorry, I should have been more clear. When you launch anything from RubyMine you see console window.
The very first line of this window is actually the command line, which is generated by RubyMine to launch the process. The problem most likely is that this command line is incorrect and doesn't take into account some environment details.



Please sign in to leave a comment.