Saturday, December 17, 2011

How 2 open pdf file using JAVA?

The Java code is as below:
Java Code:
{
    public static void main(String args[])       //main function
    {
        try                                      //try statement
        {
            Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "c:\\chart.pdf");   //open the file chart.pdf
        } catch (Exception e)                    //catch any exceptions here
          {
              System.out.println("Error" + e );  //print the error
          }
    }
}

No comments:

Post a Comment