Home Tutorials Jruby Printing Command Line arguments in JRuby
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Printing Command Line arguments in JRuby

Advertisement
In this section of JRuby tutorial we will discuss about printing command line arguments in JRuby program.

Printing Command Line arguments in JRuby

     

In this section of JRuby tutorial we will discuss about printing command line arguments in JRuby program. We can also take arguments from the command line into our JRuby program. 

This example will illustrate you how to take command line arguments in JRuby program. We have to used ARGV[] array object to take command line arguments. Here is the example code of CommandLine.rb as follows:

CommandLine.rb

# Printing commandline arguments

0.upto( "#{ARGV.length}".to_i) do |n|
puts "#{ARGV[n].to_s}"
end 

Output:


C:\JRuby>jruby CommandLine.rb Hello Welcome to RoseIndia Technologies!
Hello
Welcome
to
RoseIndia
Technologies!

 

Download Source Code

     

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: September 29, 2008

Related Tutorials

Ask Questions?    Discuss: Printing Command Line arguments in JRuby  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com