Home Tutorials Jruby Printing Command Line arguments in JRuby



Printing Command Line arguments in JRuby
Posted on: September 29, 2008 at 12:00 AM
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

     

Related Tags for Printing Command Line arguments in JRuby:
crubycomprintingioprintargumentscommandjrubytutorialintlineriathisprogramtoramargumenteilsectionlscommacanlimanfrominmntoutcajmeintoprotorssodisckislldiscussandartutorssrithablsoprndonomogro


More Tutorials from this section

Ask Questions?    Discuss: Printing Command Line arguments in JRuby  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.