Open web browser with help file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Open web browser with help file

  1. #1
    Join Date
    Jul 2004
    Posts
    54

    Open web browser with help file

    Anyone have code that will open an html help file in the default web browser? Seems that openURL has something related but docs don't go far enough.

    Thanks,
    RON C

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    You use the Runtime class for spawning processes outside your java application. The commands is like you would do from a dos shell. It goes like this:

    Code:
    import java.util.*;
    import java.io.*;
    
    public class StartAProgram {
    
      public StartAProgram(String progName, String fileName) {
        Runtime r=Runtime.getRuntime();
        try {
          r.exec(progName+" "+fileName);
        } catch (IOException ioe) {
          System.err.println("The program: "+progName+" is not available");
        }
      }
      public static void main(String[] args) {
        StartAProgram sp =
          new StartAProgram("C:\\Program Files\\Internet Explorer\\IExplore",
                            "http://www.sun.com");
      }
    }
    eschew obfuscation

  3. #3
    Join Date
    Jul 2004
    Posts
    54
    Thanks.

    I need to make it run on Mac and Linux also. Anyone help there?

    Thanks again.

    RON C

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    java is platform independant, what differs is the command string that u enter at runtime, not the code.
    eschew obfuscation

  5. #5
    Join Date
    Jul 2004
    Posts
    54
    I'm using Java because of the independence.

    Anyone know what the parms are for MAC and Linux and how to id the operating system to use the parms?.

    Thanks,
    RON C

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center