Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a file outside my application

Status
Not open for further replies.

KnightCoder

Programmer
Jan 30, 2001
16
GB
Hi People,

All i want my java program to do is open this file (index.html, it's local to the class) external to my program. i do NOT want my application to load the file within it self.

i just want to re-create the double click command.... In essence the program will terminate leaving the user with an opened file.... if the file is a HTML document i think the system should automatically open a browser window for that document.

am i right? i want the system to handle the any of those issue not my java application.

so, is there such a command in JAVA that can open or execute a document with a given file name? and consequently the sytem handle all the stress of opening the document as my J App will close....

any Help is welcome.

Thanks
Knightcoder.
 
I think you can try this:-

Runtime.getRuntime().exec("cmd /c index.html");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top