From: Swati Sharma Date: 2008-04-03T16:08:56+09:00 Subject: Re: Passing command line arguments to Ruby or JRuby script. Charles Oliver Nutter wrote: > Swati Sharma wrote: >> >> Please help me in this regard... > > Can you post an example of what you're doing? I'm not sure I understand. > You may want to look at the JRuby code used for spinning up new JRuby > instances in the same VM, since that allows passing parameters along > correctly. > > - Charlie I am writing this jruby script for the SNMP management of the wireless equipment installed in my campus. The way i have my script has 3 java classes corresponding to the 3 main scripts that i have in ruby.Below i paste the code for the rum method of one of my class categories (it just calls the corresponding ruby script): public void run() { System.out.println(getName()); try { ScriptEngineManager factory = new ScriptEngineManager(); // Create a JRuby engine. ScriptEngine engine = factory.getEngineByName("jruby"); // Enable the JRuby script engine to invoke a script in a file. Invocable inv = (Invocable) engine; // Open a file reader on the external JRuby script file. FileReader f = new FileReader("/root/NetBeansProjects/java_thread_script_test/src/java_thread_script_test/cpeping.rb"); // Evaluate (execute) the script. Once evaluated, any functions // in the script can be called with the invokeFunction method. engine.eval(f); }//end of try 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. I guess this much detail will be enough to seek your help. Waiting for your reply....... Thanks.. -- Posted via http://www.ruby-forum.com/.