aspose file tools*
The moose likes Beginning Java and the fly likes Open a HTML file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Open a HTML file" Watch "Open a HTML file" New topic
Author

Open a HTML file

Bob Mazz
Greenhorn

Joined: Mar 17, 2004
Posts: 5
Can anybody tell me some code to simply open a HTML file in a web browser please. Thankyou
Saj
Greenhorn

Joined: Dec 03, 2003
Posts: 5
Using what u need 2 achive this? Be specific when u post the queries.
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
just double click the html file it will automatically open in browser.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You can use one of the java.lang.Runtime.exec() methods to launch the browser, if you know the path to the executable. Because Java is cross-platform, you can't just assume that it's IEXPLORE.EXE . You might ask the user to find the browser program in a file-selection box, then use Runtime.exec() to launch it.


[Jess in Action][AskingGoodQuestions]
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
This definitely needs to be in an FAQ somewhere - not that anyone would read it though
Use BrowserLauncher - http://browserlauncher.sourceforge.net/
Works great.
brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Saj,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Originally posted by Brian Pipa:
This definitely needs to be in an FAQ somewhere

I agree. This topic has come up a few times.
Don't forget that you have the ability to add it to the FAQ. It's a wiki after all.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Open a HTML file