2 Replies Latest reply on Jan 26, 2012 10:02 AM by Mauricio Salatino

    Action script - how to invoke an executable?

    olddave Newbie

      Hi,

       

      This action script will give you the idea of what I need to do

       

      String osname = System.getProperty("os.name");

      if(osname.equals("Linux")) {

                 Runtime.getRuntime().exec("wineconsole --backend=user "/vendor_files/bbg_ps_enc/des.exe -D -u -k \"xcvfrew\" /vendor_files/bbg_ps_enc/equity_desc.enc.out /vendor_files/bbg_ps_out/equity_desc.out");

      } else if(osname.indexOf("Windows") == 0) {

                 Runtime.getRuntime().exec("cmd /c C:/vendor_files/bbg_ps_enc/des.exe -D -u -k \"xcvfrew\" C:/vendor_files/bbg_ps_enc/equity_desc.enc.out C:/vendor_files/bbg_ps_out/equity_desc.out");

      }


      The Window specific command works fine. The Linux command never works.

       

      I have substituted the Linux cd with this "/vendor_files/bbg_ps_enc/rundes.sh" and that does not work either. Where rundes.sh has

       

       

      #!/bin/bash

      wineconsole --backend=user /vendor_files/bbg_ps_enc/des.exe -D -u -k "xcvfrew"  /vendor_files/bbg_ps_enc/equity_desc.enc.out /vendor_files/bbg_ps_out/equity_desc.out


       

      I have tried both mvel and java types for the Action script

       

      I have tried

      "/bin/bash -c 'wineconsole --backend=user "/vendor_files/bbg_ps_enc/des.exe -D -u -k \"xcvfrew\" /vendor_files/bbg_ps_enc/equity_desc.enc.out /vendor_files/bbg_ps_out/equity_desc.out'"

       

       

      I tried adding the full path for wineconsole too, no change.

       

      I also tried

       

      String[] cmd = { "wineconsole", "--backend=user", "/vendor_files/bbg_ps_enc/des.exe", "-D", "-u", "-k", "\"xcvfrew\"", "/vendor_files/bbg_ps_enc/equity_desc.enc.out", "/vendor_files/bbg_ps_out/equity_desc.out" };

      Runtime.getRuntime().exec(cmd);

       

       

      And all combinations of the above. All these commands work perfectly inside a shell window. These techniques have been gleaned from a number of articles on the web about how to use Runtime.exec, but they do not appear to work within Drools

       

      So is it possible? If so how?

       

      Thx.

       

      Ed