File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes open a file in the external default program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "open a file in the external default program" Watch "open a file in the external default program" New topic

open a file in the external default program

C?cile Hayez

Joined: Dec 09, 2002
Posts: 1
Alright... this is what I wish to do, coding in java :
I work with html, pdf, ... files in my java program and I wish to be able, within the program, to open those files launching the default external program defined by the user in his operation system (like for exemple nescape or iexplorer to open a html file, acrobat for a pdf, ...).
Does anyone knows how I can do that?
Thanks in advance
Zippy 007
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
on a window system try the following:
open the command prompt and type "start yourfile", hit enter. then yourfile is opened using the registered application for that type of file.
you can do the same from a java programm trough the Runtime.exec() method.

this is very platform dependant, i hope somebody here can give you a hint on how to do this.
It is sorta covered in the JavaRanch Style Guide.
subject: open a file in the external default program
Similar Threads
I can't convert jsp pages to pdf why?
Publishing directory in Websphere App Server
How to convert TEXT/HTML file format to PDF format
How to create PDF file.
working with pdf.... in java j2ee