Attempting to launch a help browser from a java application

I am currently investigating being able to view help html files through launching a browser from my Java application. I have come across the java.lang.Runtime and java.lang.Process classes which allow me to launch a browser like Netscape or Explorer and bring up a html file to view.
What I want to do is launch the browser and bring up an html index file as well as the required html help file every time a user would like to use the help for my application.
Is this possible using the other exec commands. If so, how? Is there somewhere I can find a user guide for Netscape and Explorer commands in order to send additional commands to the browser in order to do this.
Thanks.

Good news is it must be possible because VisualAge does it but I don't know how.

Similar Messages

  • How can I launch a web browser from my Java application?

    I've reed about this at Question of the Week (http://developer.java.sun.com/developer/qow/archive/15/index.html). It doesn't work for me. I'm running win2000 and trying:
    try {
    Runtime.getRuntime().exec("start iexplore http://java.sun.com");
    } catch (Exception e) {
    System.out.println( e.getMessage() );
    I get:
    CreateProcess: start iexplore http://java.sun.com error=2
    What's wrong?

    This function will launch the default browser under Windows.
    public static void displayURL(String url) throws IOException   {
        String cmd = null;
        Process p;
        try  {
            String os = System.getProperty("os.name");     
            if (os != null && os.startsWith("Windows")) {
                if (os.startsWith("Windows 9") || os.startsWith("Windows Me"))  // Windows 9x/Me
                    cmd = "start " + url;
                else // Windows NT/2000/XP
                    cmd = "cmd /c start " + url;
                p = Runtime.getRuntime().exec(cmd);     
        catch(IOException x)        {
            // couldn't exec browser
            System.err.println("Could not invoke browser, command=" + cmd);

  • Launch a default web browser from my java application

    Hello,
    I have been trying to launch my default web browser from my java application, but am unable do it. Right now, I am using ---- "Runtime.getRuntime().exec("cmd /c start <url>"); to launch my webbrowser. It launches the browser but displays the command prompt for a second or so, and then replaces my already existing page with the new url.
    Is there any way for me to launch the url in a completely new browser each and every time. And I don't want the command prompt to show up for a sec. Please help...!
    Thanks in advance.
    -BusyBusyBee

    If by any chance your application is an Applet, you can use this to open a new browser window:
    getAppletContext().showDocument(new URL(theUrl), "_blank");
    But, you probably would have specified if that were the case. Oh well. Hope it helps someone!
    -sheepy.

  • Open default browser from a java application

    How is possible to make a java application that open an html file in the default browser ?
    Thankyou
    [email protected]

    You can do that by running the command "start <url>", for example using Runtime.exec().
    Runtime.getRuntime().exec("start http://java.sun.com");Jesper

  • Launching a Browser from a Java Application

    I want to open an HTML page in the "default" browser. I know how to run commands so I could open IE or Netscape but I want to open a browser without having to know what browser they have installed. It would be nice if there is something that isn't platform dependent. Is this possible?

    It would be nice if there is something that isn't platform dependent. So you've seen the java tip
    http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
    I don't think it's that easy to do what you want so that it is portable... sad that the current API doesn't have great support for programs written in other languages than Java.

  • Open URL in Web Browser from a Java Application

    Hi,
    I have an HTML document that I want to load in a browser window by clicking on a button in my java GUI application.
    Any suggestions?
    Thanks.

    You can use the Process class to start the web browser with the proper command line arguments (depends on the web browser though). Or on windows, you can have your program create a batch file with the code start url (where [url] is your url), and this will open the default web browser when run (again you must run it with a Process).

  • Closing browser from a java application

    I have an applet having a button Save on it. I am calling a javascript function of closing the browser. But if i click it, a built in message comes to confirm the closing of browser having two opitons Yes and No. Is there any possibility that the browser closes without showing this message?

    May this is the wrong forum to post this message. However you could avoid that close-dialog by setting an opener
      function closeWindow() {
        window.opener="x";
        window.close();
      }So you can fake an self-opened window.
    The behaviour depends on used browser. So this should work for IE and Opera but not for Netscape...
    br
    karl

  • Open a Windows help file from a Java application

    Help!!! Final project due Wednesday. Our project was to re-create the Windows 2k calculator, which we pretty well did, with the exception of accessing the help file. I think I am close but not sure how to deal with the compiled HTML files that Windows uses for its help utilities. The following code makes the calculator itself pop up.
    public void helpFilePopUp ()
    try
    String command = "calc";
    Process child = Runtime.getRuntime().exec(command);
    catch (IOException e)
    System.out.println("Object not found.");
    }//end of method
    Thanks in advance A.

    Maybe I didn't understand your problem correctly.
    If you just want to start the windows help with the calculator helpfile then your command should look like
    "WINHLP32.EXE c:\windows\help\calc.hlp" and not "calc".

  • Control browser properties from a java application while launching a browse

    How to control the properties of a browser when it is launched from a java application?
    I am using the command " Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+url); " to launch the browser. The syntax of "exec" command is "public Process exec(String command,String[] envp) throws IOException". I would like to know whether we can give the arguments in this command to control the browser properties.
    If you know any other option by which we can open a URL in a controlled browser, please share it.
    Thanks in advance :).
    Surekha_Venugopal

    Hi All,
    I have found a solution to control browser parameters from Java applications.
    1. Create an intermediate HTML file at runtime which contains Javascript to launch a browser. Pass the parameters like the URL and browser control parameters to the Javascript of this HTML file.
    2. Open this HTML file and invoke the javascript while loading the file. Javascript will launch the required URL in a controlled browser.
    3. Close the intermediate HTML file.
    Limitation:
    1. There will be a flickering of windows.
    2. Applets will have permission issues with the above solution. For applets a better solution is JSobject. No need of an intermediate file here.
    Hope this will be useful for someone. :-)
    Cheers,
    Surekha_Venugopal

  • How to launch a web browser from a MAC java app

    I know, this topic has been brought up over, and over, however I couldn't find info regarding MAC environments. I don't have any former experience with MAC, but now I'm getting desperate for a solution. I need to be able to pop up the default browser showing a certain URL on MAC/OS from a java application. Any clue would be appreciated.
    Thanks a lot,
    michael berdan

    I wrote libraies that will do this:
    http://ostermiller.org/utils/Browser.html
    I also keep a list of other resources to help you out:
    http://dmoz.org/Bookmarks/D/deadsea/Java_Help/Web_Browser/
    Stephen

  • Launching TextEdit on a Mac from a Java application

    I am having a problem launching textedit from a Java application. It was working a week ago on a fresh iMac, but since then I have installed Lightroom, Photoshop, the Studio MX suite stuff, and now the textedit program does not start from my Java app. This is the code that I am using in my application to launch textedit:
    String command = "open -e \""+filename.getAbsolutePath()+"\"";
    Runtime rt = Runtime.getRuntime();
    rt.exec(command);I've also tried it this way:
    String command = "open -e \""+filename.getAbsolutePath()+"\"";
    Process child = Runtime.getRuntime ().exec (command);I've printed the command to execute out on the console and it appeared like this:
    open -ef "\Users\user\Desktop\filename.txt"But it doesn't open textedit. The funny thing is, if I copy and paste that open command into the Terminal, it will open the file in TextEdit. Why won't it work in my Java app anymore, but still work through the terminal? I don't get any errors in the console, it just doesn't open TextEdit anymore. Is there a setting somewhere that might have been changed that let me start TextEdit from a Java app. I checked and TextEdit is still my default program for opening text files, which I guess makes since why it works from the Terminal, but I don't get why it doesn't start TextEdit from my Java app.
    Some of this might just be a Mac issue, I'm new to that system. But the code I'm using used to work. I guess maybe I'm looking for another (better) way of opening TextEdit on the Mac from Java.
    I'm using Java 1.5.0_07. Thanks.

    Try specifying an absolute path for open (/usr/bin/open ?).

  • I am in the process of doing a Proof Of Concept / Evaluating products that can help us build a Java Application to Convert a PDF document to a Searchable PDF.   I wanted to check is there any simple JAVA API from Adobe to achive this ? Any direction in th

    I am in the process of doing a Proof Of Concept / Evaluating products that can help us build a Java Application to Convert a PDF document to a Searchable PDF. 
    I wanted to check is there any simple JAVA API from Adobe to achive this ? Any direction in this regard is greatly appreciated.@

    You can achieve this using LiveCycle PDF Generator JAVA API. You can find required code here:
    Adobe LiveCycle * Quick Start (SOAP mode): Converting a Microsoft Word document to a PDF document using the Java API
    In parameters:
    //Set createPDF2 parameter values
    String adobePDFSettings = "Standard";
    String securitySettings = "No Security";
    String fileTypeSettings = "Standard OCR";
    "Standard OCR" file type setting will run OCR on input pdf. In the code, instead of doc file provide a pdf file. Resultant pdf will be searchable PDF i.e OCRed PDF.
    Feel feel to ask any further questions.

  • Launching a java application from another java application

    Hi,
    I'm facing an interesting challenge :-)
    Inside a Java application, I want to start another java application.
    Possible solutions in my list :
    1. Using jakarta commons launcher.
    2. Runtime.exec (make the code platform dependent).
    3. Starting the main method of the other app by create a new Thread inside the current app
    4. I know people did this by calling an ant target from the java application but I don't have
    any sample code, I appreciate any sample code for it.
    Thanks,
    Ali Salehi

    That is an iteresting challenge :)Don't be mean; he's polite, done some investigation and taken the trouble to be clear. The question, presumably, is "has anyone got a different solution or a preference as to which of these is the best?"
    In which case, my advice would be to say that invoking main in a separate thread is fundamentally different from Runtime.exec() because the former would run in the same JVM. Is this what you want? If one app has the other on its classpath then do they need to be separate apps? Could they be modules of a single app?

  • Help with calling a java application from inside another one

    Hello!
    I am having this problem which is getting on my nerves and dont know how to solve..
    I want to call from my java application, another java application. So i use the exec command. Then i want to read the output of this execution from my own application, (the "parent" process).
    But it doesn work properly. Something seems to happen and i dont get the whole output.
    The java program i want to call is created for running an application created with Matlab java builder.
    This program works when called from cmd, but seems not to work when called from inside a java application.
    The code of my java application is:
    Runtime rt = Runtime.getRuntime();
    Process child;
    // The java class getmagic is a special kind of java file that uses classes that work in matlab. It uses a component (.jar) file that is created from matlab java builder. thats why it wants the -classpath and the rest options.
    //I hope you wont get messed up in here.
    String[] callAndArgs = {"java","-classpath",".;C:\\Program Files\\MATLAB\\R2006b\\toolbox\\javabuilder\\jar\\javabuilder.jar;..\\MagicDemoComp\\magicsquare\\distrib\\magicsquare.jar -Djava.library.path=C:\\Program Files\\MATLAB\\R2006b\\bin\\win32;","getmagic","4"};
    try{
    child = rt.exec(callAndArgs);
    InputStream is = child.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null)
    System.out.println(line);
    is.close();
    System.out.println(child.waitFor());
    System.out.println("Finished");
    }catch(IOException e) {
    System.err.println("IOException starting process!");
    }catch(InterruptedException e) {
    System.err.println("InterruptedException starting process!");
    The java program (getmagic) thats uses matlab gives the following output (after some time) when called in cmd with argument 4
    Magic square of order 4
    16 2 3 13
    5 11 10 8
    9 7 6 12
    4 14 15 1
    My program shown above only prints:
    Magic square of order 4
    1
    Finished.
    Do i do something wrong? How can i get the rest of the output???
    Thank you very much in advance,
    Stacey
    PS: I am sorry for the length of my post.

    Hello CaptainMorgan08, thanx for the instant reply.
    I tried, but no, i cant.
    Because i cannot include this java aplication that uses matlab into my application, cause 1) it needs special arguments in the compiler and during execution so it can be run and 2) it uses classes that java doesnt have. only the java-like matlab code.
    For example it uses:
    import com.mathworks.toolbox.javabuilder.*;
    import magicsquare.*; //the component which is made from matlab java builder.
    So i cannot compile it with my application!
    If you know of a way, please let me know!
    I know i might be missing something.. something that is obvious to you.. but i ve been working days=nights hardly no sleep..so you can excuse me if i say something foolish..
    Message was edited by:
    Stacey_Gr

  • Launching Java Application From A Java Application

    Hello,
    I am building a compiler and would like to have run feature. The problem is I can not seem to figure out the righ syntax to run and application from my java application.
    Here is the code I am using to run an application:
    public void RunClass()
    try
    Runtime rtr=Runtime.getRuntime();
    Process pr = rtr.exec("java " + CurrentDirectory + FileNoExt);
    String line;
    BufferedReader rerr = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    if((line = rerr.readLine()) == null) { CompileMessageArea.setText("Program Running\n"); }
    while ((line = rerr.readLine()) != null) { CompileMessageArea.append(line +"\n"); }
    rerr.close();
    catch(Exception re) { re.printStackTrace(); }
    The following is an example of what the above would send to the:
    java c:\MyJava\Programs\test
    If you try to type something like that in a DOS prompt it will not work. You must first change to that directory, but I am hoping there is an easy way to change the syntax. On the other hand if you want to compile a program you can type:
    javac c:\MyJava\Programs\test.java
    and it will work just fine. This is kind of funny and I use this syntax for my compiler in my program. You would think that the same syntax would work the same for both compiling and running but it does not. So, I know that if I just know what the correct syntax that dos would except for running an application it would work.
    So, if you have the answer for me PLEASE LET ME KNOW.
    It is easily testable by keying it into the dos prompt.
    Sincerely,
    Eric Kohr

    If you want to do it that way you need to use the environment parameter of the exec() method. Use it to set your classpath to the directory that's need for the java application you are about to run... for instance.
    String[] env = new String[] {"CLASSPATH=c:\classes"}
    String command = "java somePackage.someProgram";
    Runtime.getRuntime().exec( env, command);Where your program is in the file "c:\classes\somePackage\someProgram"
    your mileage may vary :)
    You can also reflectively load classes into the running VM and invoke their main methods. This give you the ablility to control them a bit more.

Maybe you are looking for

  • Macbook won't turn on...just not working.

    My Macbook just stopped working. In the evening it was working, but when I woke up the next morning, it was not working. I tried to turn it on, but it wouldn't turn on. I changed power cords, but it was not the charge. Do you have any ideas what else

  • Why can't Illustrator CS6/CC place PSD files properly?

    I have been using Adobe products for over 15 years and one of the main features I use is placing PSD files within Illustrator and then creating my text so that is remains vector. Being a recent Creative Cloud Team member and seeing that both CS6 and

  • Multiple FFDShow processes on tray with Ovi suite?

    Hi, what are the ffdshow processes that OviSuite seems to cause: I checked with process explorer, and NokiaMServer seems to be the cluprit: This appeared after installing the newest Ovi Suite after I purchased N 8. Would be interesting to know what i

  • Create new Collection by simply dragging a "Folder" into "Collections"

    Ability to create new Collection by simply dragging a "Folder" into "Collections". Currently the collection name has to be created manually and files dragged into it. Note: Collections are important because this is the only way you can have "virtual

  • Blackberry not receiving email or accessing internet

    My Blackberry Bold 9650 is not receiving email from any of my 3 accounts and it is not accessing the internet. I know this happened once before. I ran the diagnostic for the under options - mobil network. But I don't remember what to do  next. Please