From: Swati Sharma Date: 2008-04-07T15:15:23+09:00 Subject: Re: Passing command line arguments to Ruby or JRuby script. Charles Oliver Nutter wrote: > Swati Sharma wrote: >> Now, the problem is that i have made 3 classes and each of these classes >> have to create 8 threads each (in java). so what i need is that i pass >> on the IP Address and and an integer to the ruby script so that each >> category (8 threads) can use the same ruby file instead of duplicating >> the ruby scripts for individual threads. > > Your best bet would be one of the following: > > - set a couple variables somewhere for each script run that they can use > to retrieve the IP and integer > - set up the ARGV array so it has the command-line parameters you want > to pass through > > There are also other ways to pass data into a scripting engine through > JSR223 that I won't list here, but google for them and you'll find some > good examples. > > - Charlie Thanks Charlie. i made use of the ARGV array..... now, when i am passing my parameters from java they are perfectly visible within the run method of the thread. But they are not reaching my method in the ruby script which is doing all the processing. I am making use of the JSR223 scripting engine only. The invokeFunction method is the one that passes the arguments from java to ruby. One possible reason that comes to my mind is the absence of class in my script. is it neccessary to include a class in the ruby script? -- Posted via http://www.ruby-forum.com/.