Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Opening an html page from a Java application

Super26Super26 Member Posts: 14
Hi,

I am really stumped. Can anyone tell me how to open a html page from a java application. I already know how to do it from an applet with this getAppletContext().showDocument(url). But I want to do this from a Java application itself. If a user clicks a menu item from an actual application, I want IE to start up and take them to the designated url. I would really appreciate it if someone could help me. Thanks.

Comments

  • IllcoIllco Member Posts: 382
    Since you're running windows, you can do the following trick (we used in some business applications last year). Windows lets you execute programs as well as documents. When a document is executed, the appropriate program (if known) is started. Since the appropriate program is normally IE (or otherwise the user's default browser), when executing an HTML file, IE is started. So use:
    [code]
    String docname = "http://ill11.tripod.com";
    Runtime.getRuntime().execute( docname );
    [/code]
    I don't know if I got the funcs right, otherwise check the API.
  • Andre YoungAndre Young USAMember Posts: 0

    _ // http://forcoder.org // free video tutorials and ebooks about < PHP, Swift, Objective-C, C, Scratch, R, Delphi, Visual Basic .NET, Java, Visual Basic, JavaScript, MATLAB, PL/SQL, C++, Perl, Python, C#, Assembly, Go, Ruby Scala, ML, VBScript, Bash, Prolog, Dart, Transact-SQL, FoxPro, Erlang, Lua, Ada, COBOL, Alice, SAS, Kotlin, Logo, Awk, Scheme, LabVIEW, Julia, Hack, Fortran, Crystal, Clojure, Apex, Rust, Lisp, ABAP, D, F# /> ________

Sign In or Register to comment.