Opening any document file in Java Tutorial using NetBeans IDE

0
36

Opening any document file in Java Tutorial using NetBeans IDE

This is all about Opening any document file in Java Tutorial using NetBeans IDE. In this tutorial you will learn Opening any document file in Java Tutorial using NetBeans IDE. In Opening any document file in Java, it allows you to browse any of the following file formats (.pdf, docxs,.text,.xls and many more). Opening any document file in Java Tutorial using NetBeans IDE might sometimes be useful like for example you want to view the content of the file before saving it to your database. This tutorial uses one button component in java and NetBeans IDE. Please follow all the steps below to complete this tutorial.

 

How to open any document file in Java Tutorial using NetBeans steps

First, you need to create a project by clicking the file at the top left of the NetBeans IDE and by selecting New Project you can name your project whatever you want, and then create your frame form by right clicking the Source Packages and select New Frame Form. After creating the form drag a button component in your form. Double click the button

And then copy paste the code below and paste it inside the button events function

 

  1. try {
  2.  
  3. String path = "C:\\Users\\Black Code\\Desktop\\Files\\Later post\\article.rtf";
  4.  
  5. Runtime.getRuntime(). exec ("rundll32 url.dll,FileProtocolHandler "+path);
  6.  
  7. } catch (Exception e) {
  8.  
  9. JOptionPane.showMessageDialog(null, e);
  10.  
  11. }

Then you’re done, run your project and see if it works.

Note: path variable is where the file’s located so you can change it on your own.

For questions or any other concerns or thesis/capstone creation with documentation, you can contact me through the following:

E-Mail: [email protected]

Facebook: facebook.com/RyyanSalem

Contact No.: +639098911050

Ryan A. Salem

BSIT Graduate, soon to be MIT.

System Analyst / System Developer

Related topic(s) that you make like:

1.) Automated Voting System using Java Netbeans IDE
2.) Create 3D Pie chart in Java Tutorial using Netbeans IDE

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here