0 Replies Latest reply on Aug 31, 2011 4:36 AM by Kiratj

    Executing jar file on command line [windows]

    Kiratj

      Hi,

      I am trying to run .jar file "senthil.jar" . It catures systems screenshot.
      http://sensaran.wordpress.com/2010/06/04/screen-shot-utility-using-air-2-0/

      I am using it in AIR application. I want to execute this file from  command line. I am not sure how to pass command line arguments.

      Currently i am trying to do it like :  java -jar senthil.jar

      I need to provide a parameter as "Print Screen"

       

      Its corresponding Flex Code is :

       

                  var arg:Vector.<String> = new Vector.<String>;
                  arg.push("-jar");
                  arg.push(File.applicationDirectory.resolvePath("senthil.jar").nativePath);


                   var file:File = new File();
                  file = file.resolvePath(javaPath.replace(/\//g, File.separator));
               
                  var npInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
                  npInfo.executable = file;
                  npInfo.arguments = arg;
                 
                  nativeProcess = new NativeProcess();
                  nativeProcess.start(npInfo);
                  nativeProcess.standardInput.writeMultiByte("Print Screen" + "\n", "utf-8");

      Thanks