Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open a file on the desktop

 
Tiju Thomas
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used the com.lowagie API to create a .pdf file in the workspace. How can I open it up in the acrobat reader and show to the user who is inside a swing application?
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using JDK6, check out the Desktop class. It has a convenient method called open(File file)
 
Tiju Thomas
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, my client requires the project to be run on 5.0. Any other go?
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are on Windows, you can use
 
Tiju Thomas
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much Maneesh, I could open the file using the above code.

I have seen the same code somewhere else but was not sure if this was the right way of openning a file through swing.

Anyways, thanks for the help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic