- Open a NetBeans project
- Add new Frame
- I added Tool bar and few buttons hear
- When you click 'About' button the pdf file will open
- Double click on the button and goto button's actionPerform
- Add this code
try{
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+"E:\Projects\Blogs\Java\Post\advance\openDocument\\me.pdf");
}
catch(Exception e){JOptionPane.showMessageDialog(null, e);}
- Give your file path correctly !
Important
- You can open any document using this code.
- Give your file path corectly
No comments:
Post a Comment