title: How to start JCOPShell (jcshell.bat) which is an NXP product from a custom Java Desktop Application
body: <p>I am trying to create a desktop application (created in java) which will internally run jcshell (tool from NXP which is used to interact with secure element SD card from computer) and produce the output. In jcshell I will be running script file. So this desktop application also should start jcshell internally and run the script file.</p>
  
  <p>I have executed JCOP shell commands which will communicate to secure element SD card through JCOP shell tool (jcshell.bat) provided by JCOP(NXP). Now I need to create a windows desktop application through which I should be able to run JCOP shell commands through jcshell.bat.</p>
  
  <pre><code>Process processObj = Runtime.getRuntime().exec("cmd /C dir");
  </code></pre>
  
  <p>The above code will return same output from command prompt as well as from my custom java desktop application with details of the directory.
   I am looking for something similar , but could not get jcshell.bat running from my JavaDesktopApplication.</p>
  
  <p>Any help on the above will be really appreciated</p>
  
  <p>I have tried to work with ProcessBuilder also in the following way, but could not get the expected output.In the following arraylist, first element is the path of my batch file and second element is the location of script file.My intention is to run the script file through windows application which is jcshell.bat which I used to run with the tool given by JCOP.Following is the code using ProcessBuilder.<br/></p>
  
  <pre><code>ArrayList commandList = new ArrayList&lt;String&gt;();
  commandList.add("C:\\Program Files\\NXP Semiconductors\\JCShell\\jcshell.bat");
  commandList.add("./scripts/javatest.jcsh");‌​‌​
  ProcessBuilder pb = new ProcessBuilder(commandList);
  pb.redirectErrorStream(true);
  Process p = pb.start();
  String s;
  BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
  while ((s = stdout.readLine()) != null &amp;&amp; !isCancelled()) {
      publish(s);
      System.out.println("OUTPUT == " + s);
  }
  if (!isCancelled()) {
      status = p.waitFor();
  }
  p.getInputStream().close();
  p.getOutputStream().close();
  p.destroy();
  </code></pre>