Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Blank console window after running Ruby code(Problem seeing the output of a ruby program ran in Eclispe)
Blank console window after running Ruby code [message #996265] Tue, 01 January 2013 10:37 Go to next message
Hakim Benbekhti is currently offline Hakim Benbekhti
Messages: 2
Registered: January 2013
Junior Member
I am all new in developing and I am trying to get things up and running.
I have developed the little test program called "Hello.rb":

class Hello
def Hello
puts "Hello Ruby World"
end
end

After running the program, the only thing I see in the "Console" is that "<Terminated> Hello.rb [Ruby Script] /usr/bin/ruby/" but the window is blank. I don't have any output in the Console: I do not see the output message "Hello Ruby World". Any idea why that is happening? (I use "Ruby 1.9.3″ and I use "Eclipse IDE for C/C++ Developers, Version: Juno Service Release 1″ where I have installed the "Dynamic Languages Toolkit Ruby Development Tools")

Funnily enough for the following program the output is correctly displayed in the Console:
class HelloYourName
print ('What is your name:')
name = gets()
puts ("Hello #{name}")
end

[Updated on: Tue, 01 January 2013 13:41]

Report message to a moderator

Re: Blank console window after running Ruby code [message #996314 is a reply to message #996265] Tue, 01 January 2013 14:10 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex Panchenko
Messages: 342
Registered: July 2009
Senior Member
To have some output that method should be invoke actually, e.g. like this:

class Hello
def hello
puts "Hello Ruby World"
end
end

o = Hello.new
o.hello

But if you want just print something, then you can write only puts:

puts "Hello Ruby World"

Regards,
Alex
Re: Blank console window after running Ruby code [message #996348 is a reply to message #996314] Tue, 01 January 2013 16:34 Go to previous message
Hakim Benbekhti is currently offline Hakim Benbekhti
Messages: 2
Registered: January 2013
Junior Member
Thanks Alex, perfect, it works all fine by doing what you said
Previous Topic:Instance DLTK Editor manually
Next Topic:Debugging Ruby on Eclipse
Goto Forum:
  


Current Time: Sat Aug 30 16:31:09 EDT 2014

Powered by FUDForum. Page generated in 0.03472 seconds