title: How to print error logs in output HTML file
body: <p>How to print error logs in output HTML file with the use of Java</p>
  
  <p>I am trying to convert xml to html through the use of xslt.But the output i am gettign in html file.Now in java code i am handling some FileNotFoundexception also, now suppose in case if file not found exception came then i want that error to be thrown at output HTML page</p>
  
  <p>As requested by.....PSB for the code</p>
  
  <p>public class XmlToHtml {
  public static void main(String[] args) {</p>
  
  <pre><code>if (args.length == 3 &amp;&amp; args.length !=0) {
      String dataXML = args[0];
      String inputXSL = args[1];
      String outputHTML = args[2];
  
      XmlToHtml xmltoHtml = new XmlToHtml();
      try {
          xmltoHtml.transform(dataXML, inputXSL, outputHTML);
      } catch (TransformerConfigurationException e) {
          e.printStackTrace();
          System.out.println("TransformerConfigurationException" + e);
      } catch (TransformerException e) {
          e.printStackTrace();
          System.out.println("TransformerException" + e);
      } catch (FileNotFoundException e) {
          e.printStackTrace();
          System.out.println("FileNotFoundException" + e);
      }
  } else {
      System.err.println("Wrong Input");
      System.err
              .println("Please Enter in the follwing format : Data.xml Input.xsl            Output.html");
  }
  }
  
      public void transform(String dataXML, String inputXSL, String outputHTML)
      throws FileNotFoundException, TransformerException,
      TransformerConfigurationException {
       TransformerFactory tFactory = TransformerFactory.newInstance();
      Source xslDoc = new StreamSource(inputXSL);
       Source xmlDoc = new StreamSource(dataXML);
       OutputStream htmlDoc = new FileOutputStream(outputHTML);
       Transformer transformer = tFactory.newTransformer(xslDoc);
       transformer.transform(xmlDoc, new StreamResult(htmlDoc));
       Desktop dk = Desktop.getDesktop();
       try {
          dk.open(new File(outputHTML));
  
         } catch (IOException e) {
      // TODO Auto-generated catch block
        e.printStackTrace();
       }
   }
  </code></pre>