title: Executing Cmd command in JSF
body: <p>i want to compile an input text and create the .exe file using a managed bean and a page .xhtml . However the Creation of file went Ok and the creation of .exe dosn't work
  here is the managed bean code :</p>
  
  <pre><code>package Servlets;
  
  import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.File;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.io.Serializable;
  import javax.faces.bean.ManagedBean;
  @ManagedBean(name = "fichier", eager = true)
  public class Fichier implements Serializable{
  private String code;
  private String error;
  
  
  
  
  public String getCode() {
      return code;
  }
  
  public String getError() {
      return error;
  }
   public void setCode(String code) {
      this.code = code;
  }
  
  public void setError(String error) {
      this.error = error;
  }
  
  
  
  public void compile() throws IOException 
  {
  
  
      File file = new File ("C:\\Users\\Rad1\\test.c");
      PrintWriter ecrivain;
      ecrivain =  new PrintWriter(new BufferedWriter (new FileWriter(file)));
      ecrivain.println(code);
              System.out.print("ecrivain");
      ecrivain.close();
      try {  
          Runtime runtime = Runtime.getRuntime();
           String[] cmd={"cmd.exe","/C gcc C:\\Users\\Rad1\\test.c -o C:\\Users\\Rad1\\test.exe"};
           Process p = runtime.exec(cmd,null,null );
                       System.out.print("boucle try");
            try {
              BufferedReader reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
  
              try {
  
              String line=null;
  
              while((line = reader.readLine()) != null) {
  
                   error =error+ line + "\n";
                  }
              } finally {
                  reader.close();
              }
          } catch(IOException ioe) {
              ioe.printStackTrace();
  
          }
  
  
          } 
      catch (Exception e) {System.out.println("erreur d'execution"); }
  
  
  
  
  }
  </code></pre>
  
  <p>}</p>