HTML Help in a JAVA Application?

Hope someone can answer this question. I thought that there
was a way to use HTML Help with a JAVA application, but I am being
advised by my programmer that I must use JAVA Help. I don't have a
problem with using RoboHelp to convert my HTML Help file to JAVA
Help but I do have very serious concerns about the finished output.
In a word, it is "ugly." Numbers do not align properly with text,
bullets are huge, bolded words do not come over bolded, text only
popups appear as huge windows and the list goes on... Any help will
be greatly appreciated!
Regarads,
Fran

Our Java applications work just fine with webhelp. See the
topic on my site.

Similar Messages

  • Help please! Java application and web application...

    Hi,
    I have a problem with inserting a java application (Main.java) in a web application(index.jsp).
    I found a source demo of a drag and drop application on the Internet, but now I want to
    have the drag and drop application work in a Jpanel/JFrame in a webapplication.
    The drag and drop application code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class Main {
        public static void main(final String[] args) {
            final ButtonGroup grp = new ButtonGroup();
            final JPanel palette = new JPanel(new FlowLayout(FlowLayout.LEFT));
            palette.setBorder(BorderFactory.createTitledBorder("Palette"));
            final MainPanel mainPanel = new MainPanel();
            mainPanel.setPalette(palette);
            for(int j=0; j<4; j++){
                final JToggleButton btn = new JToggleButton("Panel "+(j+1));
                palette.add(btn);
                grp.add(btn);
                btn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        mainPanel.setAdding(btn.getText());
            final JFrame f = new JFrame("Drag and drop panels");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(palette, BorderLayout.WEST);
            f.getContentPane().add(mainPanel, BorderLayout.CENTER);
            f.setSize(800, 600);
            f.setVisible(true);
    class MainPanel extends JPanel implements MouseListener, MouseMotionListener {
        private JPanel palette;
        private String adding="";
        private SubPanel hitPanel;
        private int deltaX, deltaY, oldX, oldY;
        private final int TOL = 4;  //tolerance
        public MainPanel() {
            setLayout(null);
            addMouseListener(this);
            addMouseMotionListener(this);
        public void mousePressed(final MouseEvent e) {
            if( adding != "" ){
                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                SubPanel sub = new SubPanel(adding);
                add(sub);
                sub.setSize(sub.getPreferredSize());
                sub.setLocation((int)e.getX(),(int)e.getY());
                revalidate();
                adding = "";
                return;
            Component c = getComponentAt(e.getPoint());
            if (c instanceof SubPanel) {
                hitPanel = (SubPanel) c;
                oldX = hitPanel.getX();
                oldY = hitPanel.getY();
                deltaX = e.getX() - oldX;
                deltaY = e.getY() - oldY;
                if( oldX < e.getX()-TOL ) oldX += hitPanel.getWidth();
                if( oldY < e.getY()-TOL ) oldY += hitPanel.getHeight();
        public void mouseDragged(final MouseEvent e) {
            if (hitPanel != null) {
                int xH = hitPanel.getX();
                int yH = hitPanel.getY();
                int xDiff = e.getX()-oldX;
                int yDiff = e.getY()-oldY;
                int cursorType = hitPanel.getCursor().getType();
                if( cursorType == Cursor.W_RESIZE_CURSOR){           //West resizing
                    hitPanel.setBounds( e.getX(), yH, hitPanel.getWidth() - xDiff, hitPanel.getHeight() );
                }else if( cursorType == Cursor.N_RESIZE_CURSOR){     //North resizing
                    hitPanel.setBounds( xH, e.getY(), hitPanel.getWidth(), hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.S_RESIZE_CURSOR){     //South resizing
                    hitPanel.setSize( hitPanel.getWidth(), hitPanel.getHeight() + yDiff );
                }else if( cursorType == Cursor.E_RESIZE_CURSOR){     //East resizing
                    hitPanel.setSize( hitPanel.getWidth() + xDiff, hitPanel.getHeight() );
                }else if( cursorType == Cursor.NW_RESIZE_CURSOR){     //NorthWest resizing
                    hitPanel.setBounds( e.getX(), e.getY(), hitPanel.getWidth() - xDiff, hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.NE_RESIZE_CURSOR){     //NorthEast resizing
                    hitPanel.setBounds( xH, e.getY(), hitPanel.getWidth() + xDiff, hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.SW_RESIZE_CURSOR){     //SouthWest resizing
                    hitPanel.setBounds( e.getX(), yH, hitPanel.getWidth() - xDiff, hitPanel.getHeight() + yDiff );
                }else if( cursorType == Cursor.SE_RESIZE_CURSOR){     //SouthEast resizing
                    hitPanel.setBounds( xH, yH, hitPanel.getWidth() + xDiff, hitPanel.getHeight() + yDiff );
                }else{      //moving subpanel
                    hitPanel.setLocation( e.getX()-deltaX, e.getY()-deltaY );
                oldX = e.getX();
                oldY = e.getY();
        public void mouseMoved(final MouseEvent e) {
            Component c = getComponentAt(e.getPoint());
            if (c instanceof SubPanel) {
                int x  = e.getX();
                int y  = e.getY();
                int xC = c.getX();
                int yC = c.getY();
                int w  = c.getWidth();
                int h  = c.getHeight();
                if(       y >= yC-TOL   && y <= yC+TOL && x >= xC-TOL   && x <= xC+TOL  ){
                    c.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));
                }else if( y >= yC-TOL   && y <= yC+TOL && x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.NE_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h && x >= xC-TOL   && x <= xC+TOL ){
                    c.setCursor(new Cursor(Cursor.SW_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h && x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR));
                }else if( x >= xC-TOL   && x <= xC+TOL ){
                    c.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));
                }else if( y >= yC-TOL   && y <= yC+TOL ){
                    c.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR));
                }else if( x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h ){
                    c.setCursor(new Cursor(Cursor.S_RESIZE_CURSOR));
                }else{
                    c.setCursor(new Cursor(Cursor.MOVE_CURSOR));
        public void mouseReleased(final MouseEvent e) { hitPanel = null; }
        public void mouseClicked(final MouseEvent e) {}
        public void mouseEntered(final MouseEvent e) {}
        public void mouseExited(final MouseEvent e) {}
        public void setAdding(final String string) {
            adding = string;
            setCursor(new Cursor(Cursor.HAND_CURSOR));
        public void setPalette(final JPanel panel) { palette = panel; }
    class SubPanel extends JPanel {
        public SubPanel(final String name) {
            setPreferredSize(new Dimension(100, 100));
            setBorder(new TitledBorder(new LineBorder(Color.BLACK), name));
    }This application works with JFrame, but I want to display the JFrame in a webapplication (JSP Page).
    I'm using Netbeans 6.0 (GlassFish) to create webapplication using Visual Web JavaServer Faces.
    So in summary:
    How can i display the drag and drop application into a JFrame (better in a JPanel) in a webapplication (index.jsp)??
    Hope you can help...
    Thanks in advance...
    Greetings,
    Rajsh

    So have an applet that opens a JFrame... JSP or not has nothing to do with it, since it's nothing but HTML the client gets.
    You can't have a JFrame embedded in an HTML page. And if you could have an applet but don't know how to get that copied code to fit inside (I mean, content pane is content pane), you might want to consider learning how to do that.

  • How to fill out POST HTML forms from my Java Application?

    Hi -
    I am writing a little Java GUI program that will allow a user to fill out data from the GUI and then submit that data. When they submit the data (two text fields) I want to take the two text fields and submit them via the POST form method of a HTML document over the web.
    Here is what I got so far:
    host = new URL("http", "<my_address>", web port, "/query.html");
                InputStream in = host.openStream();
                BufferedInputStream bufIn = new BufferedInputStream(in);
                for (;;)
                    int data = bufIn.read();
                    // Check for end of file
                    if (data == -1)
                        break;
                    else
                        System.out.print ( (char) data);
                }What that code does is makes a URL, opens a stream, and reads the HTML source of the file at the specified URL. There is a form that submits data via the POST method, and I would like to know how to write data to specific forms and specific input types of that form.
    Then, I'd like to be able to read the response I get after submitting the form.
    Is this possible?
    Thanks,

    Here is how one of my e-books go about Posting
    I tryied in one of my projects and it works ok
    (Tricks of the Java Programming Gurus)
    There's another reason you may want to manipulate a URLConnection object directly: You may want to post data to a URL, rather than just fetching a document. Web browsers do this with data from online forms, and your applets might use the same mechanism to return data to the server after giving the user a chance to supply information.
    As of this writing, posting is only supported to HTTP URLs. This interface will likely be enhanced in the future-the HTTP protocol supports two ways of sending data to a URL ("post" and "put"), while FTP, for example, supports only one. Currently, the Java library sidesteps the issue, supporting just one method ("post"). Eventually, some mechanism will be needed to enable applets to exert more control over how URLConnection objects are used for output.
    To prepare a URL for output, you first create the URL object just as you would if you were retrieving a document. Then, after gaining access to the URLConnection object, you indicate that you intend to use the connection for output using the setDoOutput method:
    URL gather = new URL("http://www.foo.com/cgi-bin/gather.cgi");
    URLConnection c = gather.openConnection();
    c.setDoOutput(true); Once you finish the preparation, you can get the output stream for the connection, write your data to it, and you're done:
    DataOutputStream out = new DataOutputStream(c.getOutputStream());
    out.writeBytes("name=Bloggs%2C+Joe+David&favoritecolor=blue");
    out.close();
    //MY COMMENT
    //This part can be improved using the URLEncoder
    //******************************************************You might be wondering why the data in the example looks so ugly. That's a good question, and the answer has to do with the limitation mentioned previously: Using URL objects for output is only supported for the HTTP protocol. To be more accurate, version 1.0 of the Java library really only supports output-mode URL objects for posting forms data using HTTP.
    For mostly historical reasons, HTTP forms data is returned to the server in an encoded format, where spaces are changed to plus signs (+), line delimiters to ampersands (&), and various other "special" characters are changed to three-letter escape sequences. The original data for the previous example, before encoding, was the following:
    name=Bloggs, Joe David
    favoritecolor=blue If you know enough about HTTP that you are curious about the details of what actually gets sent to the HTTP server, here's a transcript of what might be sent to www.foo.com if the example code listed previously were compiled into an application and executed:
    POST /cgi-bin/gather.cgi HTTP/1.0
    User-Agent: Java1.0
    Referer: http://www.foo.com/cgi-bin/gather.cgi
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Content-type: application/x-www-form-urlencoded
    Content-length: 43name=Bloggs%2C+Joe+David&favoritecolor=blue
    Java takes care of building and sending all those protocol headers for you, including the Content-length header, which it calculates automatically. The reason you currently can send only forms data is that the Java library assumes that's all you will want to send. When you use an HTTP URL object for output, the Java library always labels the data you send as encoded form data.
    Once you send the forms data, how do you read the resulting output from the server? The URLConnection class is designed so that you can use an instance for both output and input. It defaults to input-only, and if you turn on output mode without explicitly setting input mode as well, input mode is turned off. If you do both explicitly, however, you can both read and write using a URLConnection:
    c.setDoOutput(true);
    c.setDoInput(true); The only unfortunate thing is that, although URLConnection was designed to make such things possible, version 1.0 of the Java library doesn't support them properly. As of this writing, a bug in the library prevents you from using a single HTTP URLConnection for both input and output.
    //MY COMMENTS
    When you doing URL encoding
    you should not encode it as one string becouse then it will encode the '=' signes and '&' signes also
    you should encode all the field names and values seperatly and then join them using '&'s and '='s
    Ex:-
    public static void addField(StringBuffer sb,String name, String value){
       if (sb.length()>0){
          sb.append("&");
       sb.append(URLEncoder.encode(name,"UTF-8"));
       sb.append("=");
       sb.append(URLEncoder.encode(value,"UTF-8"));
    }

  • Help on Writing Java Application to be used in a different Language.

    Hi. I want to write application which can be used in different languages.Currently my application uses English as its default Langauge.
    I want to give the user a option to change the language.
    I think it can be done using a resource file. But I am not sure where to exactly start. Could some one give me any Ideas how it is done. Guide me please. Or give me a link to any tutorial or something.
    Thank you

    Hi,
    you would need to put string constants in a file ending with .properties. From out of your application you replace all string constants with calls to a ResourceBundle class you'd have to instantiate for the .properties file.
    ResourceBundles use a certain namin convention combining an arbitrary name with a locale such as _de for a german system for instance.
    See the API docs at http://java.sun.com/j2se/1.4/docs/api/java/util/ResourceBundle.html
    You can see an open source example of an application running in different locales at http://www.lightdev.com/dev/sh.htm
    HTH
    Ulrich

  • Adding Help in a Java application

    We have a frame with menus and a toolbar and we hope to put a help for the application.
    How can we do it in a easy way?

    There is something called the JavaHelp API... Maybe that's a solution?

  • Write HTML Files from java application

    Hello,
    i have to write HTML files from a java application.
    I am asking if anybody can give me a hint about a good simple solution (library) which can do some of the job for me.
    i know FOP for example is good to create pdf or html from xml, but i dont want to go via xml.
    the sites i need are really very simple presents emails.
    body and maybe a link for next and pervious.
    however, thank you in advance.
    a little hint will also help :)
    Sako.

    That, too, is my question.
    Be the "server" local or remote, wouldn't JSPs still
    be the easier solution? No. it will not. because you need a server. Server for a stand alone application is not esier. according to who said JSPs are easy?
    Its very very difficult.
    >
    When answering, please clarify. I'm a bit of a newbie
    here. :)To get sence about how hard is JSP, check Struts. this is very good open source Framework to simplify the JSPs. but it still complecated enough.
    or Tapestry my lovely open srouce Framework.
    its easier than Struts. but sill complecated because of the documentation.
    All in all, using JSP is the purpose of Java in the internet. but not for me. My application will not be available in the internet, i.e. no server, i.e. no need for JSP.
    i hope that helps a little.

  • Html and email link in a java application

    Hi all
    How do you put a email or HTML link into a Java application.
    I want to put my web site address and email address into a about dialog.
    I would like to be able to open the default email application and web site from this dialog box.
    Thanks to all
    Craig

    Try just making a label, and formatting it to look like a generic link. Then add a listener that performs the desired action when you click on it. The "desired action" would probably involve starting the user's default browser/mail-program and loading something in it. I have no idea how to do that, but the above should at least get you a "link" that responds when you click it, and that's a start.

  • How do I tell the installer to put my html help files in the helpdir symbolic location?

    I used the File>>Print function to create an HTML help file for my application and specified in the VI Properties for the app to use <helpdir>:\ApplicationHelp.HTML as the Help Path. This should pop up the help file when a user selects "Help for This VI" from my custom menu. It works from my development directory because I installed the help files into the help directory manually, but I can't figure out how the get the installer to put the files in the correct location on the target system.  I tried putting them in [LabVIEW 2010 Help] in the Destination View for the Source Files category, but that didn't work.  Anyone know the right way to do this?

    kgarrett88 wrote:
    Hey MrSmith, 
    In LabVIEW 2010 SP1, if open the Project and right click My Computer, you can add the help file as a source. After you have added this file, you can then create an installer. Under the Destination header, you can add your desired destination path. After you have done that, you can go to the Source Files header and add the help file to that destination you created. 
    Hope this helps. Good luck with your application!
    ~kgarrett
    Thank you for the reply! I had already done the steps you suggested, so let me put up some screen shots that should help you understand my issue better. First, I specified the path to the help information on the Documentation screen of the applications Properties:
    Next I had added all the help files (DetectorFT.html and all the .png files) to the source in a virtual folder I named Resources.
    Next, for the release build I specified the files to be Always Included on the Source Files header.
    Next I created a Resource Directory as a destination for the release build.
    Then I specified the Resource directory as the destination for the files for the Release build.
    After creating the Release build, I created an Installer build and told it on the SOurce Files screen to put the help files into the [LabVIEW 2010 Help] directory.
    I had assumed that putting the files in the [LabVIEW 2010 Help] destination would put them into the correct directory when the installer ran.  When I ran the installer on the target system, the ran the application I tried to select the "Help for This VI" tab on the menu, but it was grayed out indicating it could not find the file in the proper location.  So the question I have is, what IS the proper location for the files to be installed to so the the application will find the Help files when it is looking for them at the <helpdir> Symbolic Path location? Thanks again!
    Jim Smith

  • Integrating Webhelp in a Java Application

    In order to use Robohelp-generated help with my java application I need to compile, incorporate and distribute the file RoboHelp_CSH.java with my application. In addition I would like to make some modifications to the file. However the source includes the statement "Copyright© 2008 Adobe Systems Incorporated. All rights reserved." at the top of the file. This statement appears to prevent re-distribution which would seem to negate the purpose of providing this file in the first place. How are other users dealing with this?
    Thanks,
    David

    Hi David. You'll have seen that various people have responded to the same query on the HATT forum. If I were you I'd stick to asking RoboHelp related queries here in future.
    For anyone else who may have a similar issue in the future, the consensus seems to be that your RH licence gives you the right to redistribute whatever file is required to access the help. However changing a file would be a copyright contravention. If in doubt, contact Adobe Support.

  • How to create a java application & call it from a PDA via TELNET

    Dear All,
    My objective is to create a java application that's hosted on a server and called remotely from a PDA using TELNET.
    I've created a java application using Eclipse & the jCurses library. Unfortunately, the jCurses API events and listener aren't enough and i wasn't able to achieve my target application functionality.
    Can anyone advise a library other than jCurses that can help create a java application that can be called from a PDA via TELNET?
    Is AWT an option ?
    Thanks in advance for your support,
    Best regards,
    Lana

    user10827661 wrote:
    My objective is to create a java application that's hosted on a server and called remotely from a PDA using TELNET.
    I've created a java application using Eclipse & the jCurses library. Unfortunately, the jCurses API events and listener aren't enough and i wasn't able to achieve my target application functionality.
    Can anyone advise a library other than jCurses that can help create a java application that can be called from a PDA via TELNET?
    Is AWT an option ?Your server side Java application can use a Java library that
    creates a java.net.ServerSocket to listen for TCP connections from TELNET clients.
    You do not need any graphics (jCurses or AWT) on the server side, telnet is a simple ascii protocol.

  • How can I open help file (HTML or .chm) from Java Web Start (new to JAVA)

    Hi All,
    Im trying to open the help file of my application.
    When trying to access the help file from the GUI (pressing F1 for launching the help file), I'm geting the an error, something like:
    "Can't show help URL: jar:file:C:\Documents and Settings\%USER%\Application Data\Sun\Java\Deployment\javaws\cache\http\Dlocalhost\P7001\DMwebstart\RMjar-name!/com/resources/helpFiles/MyHelpFile.html"
    It seems that the file which is packed in a jar, was downloaded to the Java Web Start cache directory:
    C:\Documents and Settings\%USER%\Application Data\Sun\Java\Deployment\javaws\cache\http\Dlocalhost\P7001\DMwebstart
    The code which is activated when launching the help file is:
    try
                ResourceBundle resourceBundle = DoubleResourceBundle.getBundle("Resource", "ResourceImpl");
                RuntimeUtil.launchFile(new File(resourceBundle.getString("help.file")));
            } catch (IOException e)
                // TODO Auto-generated catch block
                e.printStackTrace();
            }where the property "help.file" is in some property file in the resource bundle named "Resource", and looks like this :
    help.file="com/trax/docs/help/global/MyHelpFile.html"
    The function "RuntimeUtil.launchFile" knows how to launch any file in its default application, and indeed it does launches the html, when giving it an absolute path to the file on my PC, as "C:\Helpfiles\MyHelpFile.html" as such:
    RuntimeUtil.launchFile("C:\Helpfiles\MyHelpFile.html");My question is :
    The application is going to be deployed on a Customer PC. How can I access the html file from the code, with a relative path and not its absolute path on the customer pc, which I can't know?
    I found these restrictions regarding web start:
    (copied from "http://rachel.sourceforge.net/"):
    *Rule 1: Java Archives only. No loose files.* All your resources have to be packaged in Java Archives (jar) if you want to have
    them delivered to the user's machine and kept up-to-date automatically by Java Web Start.
    *Rule 2: No file paths.* You can't use absolute or relative file paths to locate your
    jars holding your resources (e.g. <code>jar:file:///c:/java/jws/.cache/resources.jar</code>).
    Absolute file paths won't work because you never know where Java Web Start
    will put your jar on the user's machine. Relative file paths won't work because Java Web Start
    mangles the names of your jars (e.g. <code>venus.jar</code> becomes <code>RMvenus.jar</code>)
    and every JNLP client implementation has the right to mangle your names
    in a different way and you, therefore, can't predict the name with
    which your jar will be rechristend and end up on the user's machine in
    the application cache.Seems complex or impossible, to perform a simple task like opening a file.
    Please advise (I'm new to Java and Web Start).
    BTW, I'm working with IntelliJ IDEA 5.0.
    Thanks,
    Zedik.
    {font:Tahoma}{size:26pt}
    {size}{font}

    the follwing method i have used to open html file ...
    so to access html file i am shipping resources folder with jar file ..
    private void openHtmlPages(String pageName) {
         String cmd[] = new String[2];
         String browser = null;
         File file = null;
         if(System.getProperty("os.name").indexOf("Linux")>-1) {
              file = new File("/usr/bin/mozilla");
              if(!file.exists() ) {
              }else     {
                   browser = "mozilla";
         }else {
              browser = "<path of iexplore>";
         cmd[0] = browser;
         File files = new File("");
         String metaData = "/resources/Help/Files/"+pageName+".html"; // folder inside jar file
         java.net.URL url = this.getClass().getResource(metaData);
         String fileName = url.getFile();
         fileName = fileName.replaceAll("file:/","");
         fileName = fileName.replaceAll("%2520"," ");
         fileName = fileName.replaceAll("%20"," ");
         fileName = fileName.replaceAll("jarfilename.jar!"," ").trim();
         cmd[1] = fileName;     
         try{
              Process p = Runtime.getRuntime().exec(cmd);
         }catch(java.io.IOException io){
                   //Ignore
    can anyone give me the solution..???
    Regards
    Ganesan S

  • To show a html page from java application

    hi everyone,
    I am trying to show a html page through java application. What i tried is Runtime.getRuntime().exec("start url"); this shows it opens default browser. It works fine for win Nt but does not work on win98 or linux.
    Is there any other way of achieving the same?
    can anyone help me in this regard. I am in urgent need of it. any reply will appreciate.

    I hope this works.
    String urlName = "http://forum.java.sun.com";
    String browser = "iexplore "; //EXE file name --> for iexplore.exe
    Runtime.getRuntime().exec(browser+urlName);

  • Help about opening a PHP page from a Java application

    Hi,
    I would have some elements to open a PHP page from a little Java application I'm doing. I would like to know the classes I had to use, how to implement them, ...
    In fact, I dial into my application my login, my password, and when I click on by "Connect" button, I must show the PHP page corresponding ti my profile onto the database. Picking up information from the database is not a problem, I know how to use SQL Packages in Java. The problem is to open a new page (IE or Netscape) when clicking on the "Connect" button in my application.
    Thanks a lot for advice me.
    C�dric

    Hi
    This class is from JavaWorld Tip 66 and I've used it to open web pages and files in a browser.
    import java.io.IOException;
    import java.util.*;
    * A simple, static class to display a URL in the system browser.
    * Under Unix, the system browser is hard-coded to be 'netscape'.
    * Netscape must be in your PATH for this to work.  This has been
    * tested with the following platforms: AIX, HP-UX and Solaris.
    * Under Windows, this will bring up the default browser under windows,
    * usually either Netscape or Microsoft IE.  The default browser is
    * determined by the OS.  This has been tested under Windows 95/98/NT.
    * Examples:
    BrowserControl.displayURL("http://www.javaworld.com")
    BrowserControl.displayURL("file://c:\\docs\\index.html")
    BrowserContorl.displayURL("file:///user/joe/index.html");
    * Note - you must include the url type -- either "http://" or
    * "file://".
    public class BrowserControl
         * Display a file in the system browser.  If you want to display a
         * file, you must include the absolute path name.
         * @param url the file's url (the url must start with either "http://"
    or
         * "file://").
        public static void displayURL(String url) throws Exception
            boolean windows = isWindowsPlatform();
            String cmd = null;
            try
                if (windows)
                    // cmd = 'rundll32 url.dll,FileProtocolHandler http://...'
                    cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
                    Process p = Runtime.getRuntime().exec(cmd);
                else
                    // Under Unix, Netscape has to be running for the "-remote"
                    // command to work.  So, we try sending the command and
                    // check for an exit value.  If the exit command is 0,
                    // it worked, otherwise we need to start the browser.
                    // cmd = 'netscape -remote openURL(http://www.javaworld.com)'
                    cmd = UNIX_PATH + " " + UNIX_FLAG + "(" + url + ")";
                    Process p = Runtime.getRuntime().exec(cmd);
                    try
                        // wait for exit code -- if it's 0, command worked,
                        // otherwise we need to start the browser up.
                        int exitCode = p.waitFor();
                        if (exitCode != 0)
                            // Command failed, start up the browser
                            // cmd = 'netscape http://www.javaworld.com'
                            cmd = UNIX_PATH + " "  + url;
                            p = Runtime.getRuntime().exec(cmd);
                    catch(InterruptedException x)
                        System.err.println("Error bringing up browser, cmd='" +
                                           cmd + "'");
                        System.err.println("Caught: " + x);
                        throw x;
            catch(IOException x)
                // couldn't exec browser
                System.err.println("Could not invoke browser, command=" + cmd);
                System.err.println("Caught: " + x);
                throw x;
         * Try to determine whether this application is running under Windows
         * or some other platform by examing the "os.name" property.
         * @return true if this application is running under a Windows OS
        public static boolean isWindowsPlatform()
            String os = System.getProperty("os.name");
            if ( os != null && os.startsWith(WIN_ID))
                return true;
            else
                return false;
         * Simple example.
        public static void main(String[] args)
          try
    //        displayURL("file://c:\\Manual\\Amphibian Accounting Help Test 3.pdf");
    //        displayURL("http://www.pro7.co.za");
            Properties prop = System.getProperties();
    //        Enumeration enum = prop.propertyNames();
            Enumeration enum = prop.keys();
            while(enum.hasMoreElements())
              enum.nextElement();
          catch(Exception e)
        // Used to identify the windows platform.
        private static final String WIN_ID = "Windows";
        // The default system browser under windows.
        private static final String WIN_PATH = "rundll32";
        // The flag to display a url.
        private static final String WIN_FLAG = "url.dll,FileProtocolHandler";
        // The default browser under unix.
        private static final String UNIX_PATH = "netscape";
        // The flag to display a url.
        private static final String UNIX_FLAG = "-remote openURL";
    }If you find a better solution please let me know!
    Regards
    Michael Williams

  • 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.

  • Help needed  while exporting crystal reports to HTML file format using java

    Help needed  while exporting crystal reports to HTML file format using java api(not using crystalviewer).i want to download the
    html file of the report
    thanks

    the ReportExportFormat class does not have HTML format, it has got to be XML. Export to HTML is available from CR Designer only.
    Edited by: Aasavari Bhave on Jan 24, 2012 11:37 AM

Maybe you are looking for

  • IOS 8.1 - after update how can I get my lost calendar data back?

    Hi, after the update to iOS 8.1 is my calendar empy. All my appointements are gone and there is no way to safe new appointments in it. I tried to use the backup  of the data, but it did not work. Any clou how can I get my lost calendar data back? And

  • Exporting to Flash without embedding music files

    I had to create a music player for a website, and really didn't want to make a flash player from scratch again. So I had an epiphany and opened Keynote. I created a slideshow: the first page was a "Click on song to play" and every page after the firs

  • How do I disable my double sided printing?

    I have an HP Office Jet PRO 8600 N911a printer and a MacBook Pro (OSX 10.9.2). I can't seem to disable the double sided printing. I do not have a copy doublesided box to check or uncheck when I use the drop down menu to print.  Can you tell me how to

  • Contribute Editing file

    my problem is that I am using a template website and when I bring it into edit it gets all scrambled and images, text, etc. are all over the place. My web page is uneditable. Does anyone know how to fix that ???

  • How can I buy more than 2 iPhones?

    I want to use 14 of these phones in my company (outside of the US) but I can't find any way to buy more than 2 of them. Help please?