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! |