aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes load web page from standalone app? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "load web page from standalone app?" Watch "load web page from standalone app?" New topic
Author

load web page from standalone app?

Marc Santiago
Greenhorn

Joined: Dec 11, 2003
Posts: 12
From a standalone application, I want to start up a browser session (if one isn't available already) and load a web page (my website's FAQ). How do I do this?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

Runtime.getRuntime().exec()
Or if you prefer a pure java solution, you can display HTML in
Swing Components.


[How To Ask Questions On JavaRanch]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

Actually, this is a good example of how to display HTML using Swing.
Vinod Chandana
Ranch Hand

Joined: Aug 26, 2003
Posts: 59
hi,
one way to do it is to use Runtime and give an exec call to
"iexplore YourURL"

Hope this helps.
Vinod.
Marc Santiago
Greenhorn

Joined: Dec 11, 2003
Posts: 12
I'm kind of looking for a non-platform-specific implementation, so starting an instance of IE wouldn't always work. What I was really looking for was a way to say to the OS, 'I want to display this web page - go fire up whatever you use for a browser and load this URL'.
I'm curious about the Swing implementation. Does this embed a web browser into your standalone app, or does it somehow invoke the OS's 'default' web browser? If it uses its own embedded browser, would it understand Javascript? I couldn't tell from just reading the page.
Thanks everyone for all your help!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

Originally posted by Marc S.:
I'm curious about the Swing implementation. Does this embed a web browser into your standalone app, or does it somehow invoke the OS's 'default' web browser? If it uses its own embedded browser, would it understand Javascript?

JeditorPane and JTextPane are Java GUI controls which can be used to display HTML (and other formatted text). I do not believe it understands Javascript. There is no cross-platform way to invoke the OS's 'default' web browser.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

A lot of work was put in to Browser Opener - com.Ostermiller.util Java Utilities. This is as platform independant as you can get. There is no java class ( besides the Runtime class, which is OS specific ) which can do this.
Jamie
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

On another note:
Marc S.:
Welcome to the Ranch! We hope you’ll enjoy pounding back pints of java help on a regular basis. However, we do have one tiny rule around these parts. Please change your display name to one that satisfies our tiny rule, the naming policy( The skinny of the rule: just use a real firstname, followed by a space and a real lastname ). That's all! Thanks again and we hope to see you ordering up pints of java help and pitchers of java answers on a regular basis!
Jamie
Marc Santiago
Greenhorn

Joined: Dec 11, 2003
Posts: 12
The Ostermiller Browser looks like exactly what I'm looking for. Thanks!
Oh, and I fixed my name. Sorry about that - I'm just a little paranoid about my private info.
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
BrowserLauncher. I have used it for years:
http://browserlauncher.sourceforge.net/
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
I'm moving this to the Other APIs forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: load web page from standalone app?