Opening HTML from Java executable?

I have an HTML file that will be located on a CD that spawns off an installation. I need to call this HTML from a java executable. How do I do this?
Thanks,
Scott Roth
[email protected]

You may adopt a refined solution trough the swing package.... Usign the application to shows the HTML file with a JEditorPane or JPane component.
take a look in the jdk1.2.2\demo\jfc\SwingSet\HtmlPanel.java
In this case, your app may becomes slow, but if you will run it in a powerfull machine (128Mb RAM, 16Mb Video) then don�t worry - it works.

Similar Messages

  • Open URL from Java in a new browser tab

    Hi OTN,
    Surprisingly can't find the implimintation.
    In an ADF managed bean I retrieve String url. I need to open a new browser tab with this url.
    Found this thread Open a url in a new window in the backing bean which shows using javascript "service.addScript(facesContext, "window.open(http://www.google.coml)");".
    But in my case in doesn't work. The code is executed, but nothing happens. Maybe because the bean is called from a taskflow inline popup.
    ADF 11.1.1.4
    Thanks.

    Well, I'm afraid that is not an option.
    The goButton is in a table row. There are lots of rows so if I use EL for Destination attribute the URL would be retrieved for each of rows.
    The method of URL retreiving is heavyweight operation which includes calling plsql functions, working with strings and others. So if I do it for each table row my application hungs and then I receive an exception of CPU usage.
    That's why I switched to normal commandButton witch actionListener which retrieves url on click - only once. So I need to open URL from Java.

  • Open Word From Java

    Hi all,
    Can we open word from java.
    It is possible from VB to do it, bit is it possible from Java.
    Thanks in advance for your help.
    Best regards.
    Saadi MONLA

    Probably have to do it using Runtime.exec() and call the word exe in the seperate process.
    Note that word will be opened in a seperate OS thread and you will not be able to refer to it from your Java Application.

  • Problem opening device from Java on Windows XP

    Hi,
    I am having trouble opening the TUN device (it is a virtual network device developed by the OpenVPN project - http://openvpn.net) from Java on Windows.
    I found from the registry that the key for the device on my machine is
    {5998ABF4-70CC-4B8C-9CBF-F2B985BAD4A2}.
    From elsewhere on the web, I found that on Windows this device can be
    addressed as \\.\{5998ABF4-70CC-4B8C-9CBF-F2B985BAD4A2}.tap
    I then wrote up a short C code,
    char *tun_dev_name = "\\\\.\\{5998ABF4-70CC-4B8C-9CBF-F2B985BAD4A2}.tap";
    FILE *f = fopen(tun_dev_name, "rw");
    fclose(f);
    HANDLE h = CreateFile(tun_dev_name, GENERIC_WRITE | GENERIC_READ, 0, 0, \
    OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0);
    CloseHandle(h);In the above code, the FILE* returned is non-NULL and the HANDLE returned is positive.
    However, when I try to do the same in Java using the code below,
    String tun_dev_name =
    new String("\\\\.\\{5998ABF4-70CC-4B8C-9CBF-F2B985BAD4A2}.tap");
    RandomAccessFile raf = new RandomAccessFile(tun_dev_name, "rw");
    []/code]
    a "java.io.IOException: Invalid argument" is thrown. The same exception is thrown when I try to open either FileInputStream or FileOutputStream instead of RandomAccessFile.
    In fact, when I invoke the above C code as a native method from within Java,
    though a valid HANDLE is still returned, the FILE* returned is now NULL. I
    have tried giving all permissions to my codebase using Java's policytool, but that didn't help. BTW, I ran all this code on Windows XP from cygwin.
    Clearly this problem isn't with OpenVPN because I'm able to open the device using both fopen and CreateFile from C. Please let me know if one of you knows what the problem could be and what I need to do to fix it. In case, this is not the right forum for this question, kindly let me know which other forum I should pose this question on.
    Thanks!
    Harsha                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    I am sorry but looks like somehow some text got missed out from my message.
    After the C code and before the Java code, I had intended to mention that when that C code is compiled and run independently, both the fopen and CreateFile calls work fine, with a non-NULL FILE* and a valid HANDLE being returned, respectively.
    And as I have already mentioned, when I invoke the C code as a native method from within Java, the CreateFile still works but the fopen fails returning NULL.
    Sorry for missing that out. Hope somebody will be able to help me out.
    Thanks!
    Harsha

  • Calling html from java with some values

    Hello friends,
    I can call a HTML file from java.I want to pass some values from java class file to that html file.Anybody help me how to pass parameters?
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://localhost:8080/jcoDemo/dp.html");
    is one i am using for calling html file
    thanks

    Just add GET query parameters to the URL.
    Besides, if you were using Java 1.6 or newer, then rather use [Desktop#browse()|http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#browse(java.net.URI)] instead of Runtime#exec(). It is crossplatform while your runtime approach works in Mircosoft Windows systems only.

  • Problem with opening browser from Java app.

    Hi guys, I'm not sure if this is the right place to post this, so please excuse me if I'm wrong. I'm trying to open an html page (it's a help file) from a Java application. I'm currently using java.awt.Desktop.     browse(URI uri); which gets the job done, as long as I don't pass any parameters to the page. (e.g. http://www.site.com/site.html?param1=1). Doing that gives me an IOException. Is there a way to do this without using the JNLP API?

    This is the file path copied directly from the browser's address bar:
    file:///home/riaan/EMCHelp/Help.html?page=WorkFlowActivityCategory.html"{code}
    Which causes the app to throw an exception, but when I change it to:
    {code}file:///home/riaan/EMCHelp/Help.html{code}
    it opens Help.html in the browser.  That's why I thought that it might be the query that's a problem.  Perhaps it's a simple issue of not escaping a character or something that I failed to see.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Print HTML from Java

    Hello All,
    can anyone please provide example code of how to print an html-file from localhost by Java-code ?
    Thanx a lot !!

    Not sure what you are asking. You've mentioned several different things.
    One is printing - do you mean to put something on paper? There should be examples on how to print a file if you do a search.
    The other is 'from localhost' - this implies a socket to connect to 127.0.0.1 - Does your code connect to an HTTP server, issue a HTTP GET for an HTML page?
    Again there should be sample code for connecting to a server and reading the response if you do a search.

  • Parsing HTML from Java, How

    Problem:
    I need to Connect to a URL using Java.
    Then i need to detect/ parse the html of the url for Image contents
    *So that i can replace some thing rather than the image such as with the text [IMAGE].*
    I already able to connect and read the htmls of url. But i need ur help regarding parsing for image links.
    Just i need to parse the html page to sense image links/contents on that page.
    How it can be done?

    hi shazzad,
    Could you please try with this,
    * XsdReader.java
    * Created on September 12, 2008, 11:36 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package EDITool;
    import java.io.File;
    import java.io.IOException;
    import java.util.Hashtable;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    * @author Rajesh
    public class XsdReader {
        /** Creates a new instance of XsdReader */
        private DocumentBuilder docBuilder;
        private Document doc;
        private DocumentBuilderFactory docBuilderFactory;
        private File xsdFile;
        private File xmlFile;
        private Hashtable dataList;
        private String modXML = "";
        public XsdReader() {
            docBuilder = null;
            doc = null;
            docBuilderFactory = DocumentBuilderFactory.newInstance();
            try{
                    docBuilder = docBuilderFactory.newDocumentBuilder();
            catch(ParserConfigurationException e)
                    System.out.println("Wrong parser configuration: " + e.getMessage());
            this.xsdFile = null;
            this.xmlFile = null;
            dataList = new Hashtable();
        public class Attr{
        private String minOccurs;
        private String maxOccurs;
        public Attr(String minOccurs, String maxOccurs)
                this.minOccurs = minOccurs;
                this.maxOccurs = maxOccurs;
        public void xsdParser(String xsdInputFileName,int level)
            try{
                this.xsdFile = new File(xsdInputFileName);
            catch(Exception e)
                System.out.println("File Not Exception: "+e);
            try{
              doc = docBuilder.parse(this.xsdFile);
                    NodeList nodeList = doc.getChildNodes();
                    xsdRecursive(nodeList,level);
         catch(SAXException e)
              System.out.println("Wrong XML file structure: " + e.getMessage());
         catch(IOException e)
              System.out.println("Wrong XML file structure: " + e.getMessage());
         catch(Exception e)
              System.out.println("Error: "+e);
        public void xsdRecursive(NodeList nodeList, int level)
            try{
              for(int i=0;i<nodeList.getLength();i++)
                   Node node = nodeList.item(i);
                   if(node.getNodeType() == node.ELEMENT_NODE  && level == 1)
                        if(node.hasAttributes())
                             Element e = (Element)node;
                             String minOccursValue = e.getAttribute("minOccurs");
                             if(!minOccursValue.equals(""))
                                  String name = e.getAttribute("name");
                                  if(name.equals(""))
                                  name = e.getAttribute("ref");
                                  if(name.equals(""))
                                  continue;
                                  String minOccurs = e.getAttribute("minOccurs");
                                  String maxOccurs = e.getAttribute("maxOccurs");
                                  System.out.println(name);
                                  this.dataList.put(name,new Attr(minOccurs,maxOccurs));
                            else if(node.getNodeType() == node.ELEMENT_NODE  && level == 2)
                                String currentTagName = node.getNodeName();
                                Attr attr = (Attr)this.dataList.get(currentTagName);
                                NamedNodeMap nodeAttr = node.getAttributes();
                                org.dom4j.Node dom4jNode = (org.dom4j.Node) node;
                                org.dom4j.Element e = (org.dom4j.Element) dom4jNode;
                                e.addAttribute("min", attr.minOccurs);
                                e.addAttribute("max", attr.maxOccurs);
                   if(node.hasChildNodes())
                   xsdRecursive(node.getChildNodes(),level);
              catch(Exception e)
                   System.out.println("Error: "+e);
        public void xsdRecursive(Node node, int level)
            NodeList nodeList = node.getChildNodes();
            try{
                for(int i=0;i<nodeList.getLength();i++)
                if(node.getNodeType() == Node.ELEMENT_NODE )
                   // if(level == 1)
                    if(node.hasAttributes())
                        Element e = (Element)node;
                        String minOccursValue = e.getAttribute("minOccurs");
                        if(!minOccursValue.equals(""))
                                String name = e.getAttribute("name");
                                if(name.equals(""))
                                name = e.getAttribute("ref");
                                String minOccurs = e.getAttribute("minOccurs");
                                String maxOccurs = e.getAttribute("maxOccurs");
                                System.out.println(name);
                                this.dataList.put(name,new Attr(minOccurs,maxOccurs));
                    else if(level == 2)
                    System.out.println("rajesh");
                    String currentTagName = node.getNodeName();
                    Attr attr = (Attr)this.dataList.get(currentTagName);
                    NamedNodeMap nodeAttr = node.getAttributes();
                    org.w3c.dom.Attr minAttr = ((Document)node).createAttribute("min");
                    minAttr.setValue(attr.minOccurs);
                    org.w3c.dom.Attr maxAttr = ((Document)node).createAttribute("max");
                    minAttr.setValue(attr.maxOccurs);
                    Element e =(Element)node;
                    System.out.println(e.getNodeName()+"\t"+e.getAttribute("min"));
            catch(Exception e)
                System.out.println("Exception in xsdRecursive: "+e);
        public void display()
            Attr attr = (Attr) this.dataList.get("ISA01");
            System.out.println(attr.maxOccurs+"\t"+attr.minOccurs);
        public static void main(String s[])
            XsdReader xsdReader = new XsdReader();
            //String xsdInputFileName = "C:/Documents and Settings/vs73471/Documents/SAP/workspace/Sample/src/packages/com/sap/java/Copy of 850.xml";
            String xsdInputFileName = "C:/Documents and Settings/vs73471/Desktop/www.html";
            xsdReader.xsdParser(xsdInputFileName, 1);
            System.out.println(xsdReader.dataList.size());
            String xmlInputFileName = "C:/Documents and Settings/vs73471/Desktop/Reference XML Generate/850_Dummy.xml";
            xsdReader.xsdParser(xmlInputFileName, 2);
          //  xsdReader.display();
    }

  • Open PDF from java app

    How can I create a link in a java standalone application to open a pdf file??? (with Acrobat)
    thanks

    And what do you mean by "link"?

  • Set Text to a frame.html from java

    Hi everybody
    This is my case:
    i have a string (in java code) and i want to show it on a frame.html page
    Do u have any ideas ????
    help !!!!!
    pls !!!!!

    It sounds like you might want to create a Java Server Page. Java Server Pages, or JSP's allow you to present information created dynamically within a static html page. The dynamic content, the Java String, would be enclosed within special tags.
    You can learn more about JSP pages by visiting these links...
    http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
    http://pdf.coreservlets.com/
    http://java.sun.com/developer/technicalArticles/javaserverpages/JSP20/
    http://java.sun.com/developer/technicalArticles/Programming/jsp/

  • Opening files from java application by other programs

    Hi! Could you tell me how to solve such task. After saving of file on local drive by applet i need to show a link "View file" that will open file by assotiated programs (.doc - MSWord, .pdf - Acrobat Reader etc. applet will work on Linux platform too). Thanks!

    Just provide a link to the file and leave it up to the OS to determine which program to use to open it.

  • OLE Objects - How to open them in Java?

    Hello ppl,
    An OLE Object contains a header set by the Access Database and the file itself.
    I just quit trying to find a way to remove the OLE header and get only the file, once the file inside the OLE Object might be from a lot of types, like docs, or pdfs...
    Now, I just want to take this OLE Object and open it from Java.
    Does anybody know any way for me to do this?
    http://edndoc.esri.com/arcobjects/9.2/java/api/arcobjects/com/esri/arcgis/carto/IOleFrameProxy.html#open()
    In this link, this method describes exactly what I want. But I don�t think I�m allowed to use it.
    Isn�t there any free library that helps inthis subject?
    Thanks in advice.

    I don't see that this is a JDBC topic.
    Presumably you googled for this.
    You can of course write JNI code to access OLE.

  • How to call 'WordPad' from java program........

    The following code will open 'Notepad'
    Runtime runt = Runtime.getRuntime();
    Process pr = runt.exec( "notepad" );likewise, I want to open 'Wordpad'
    Runtime runt = Runtime.getRuntime();
    Process pr = runt.exec( "wordpad" );The above two line code, compiles successfully, but it doesn't give the correct result.
    If I give 'wordpad' in start->run->'wordpad', in windowXP means, the Runtime executer opens 'WordPad',
    can anyone give the solution to open WordPad from Java Programming.
    thanks
    Sarwan_Gres

    Try this:
            Runtime runt = Runtime.getRuntime();
            Process pr = runt.exec("cmd /c start wordpad");

  • Open url from xchat in opera

    I'd like to open urls from xchat in opera.
    Under settings>advanced>url handler:
    !opera -remote 'openURL(%s)'
    xchat has tcl as an optional dep, so I installed that.
    This is in xfce4 and I have set opera as the preferred browser.

    Well, I'm afraid that is not an option.
    The goButton is in a table row. There are lots of rows so if I use EL for Destination attribute the URL would be retrieved for each of rows.
    The method of URL retreiving is heavyweight operation which includes calling plsql functions, working with strings and others. So if I do it for each table row my application hungs and then I receive an exception of CPU usage.
    That's why I switched to normal commandButton witch actionListener which retrieves url on click - only once. So I need to open URL from Java.

  • How to run Other application from Java

    I want to run other applications such as IE.exe, notepad.exe from Java? How can I run?

    Dear Friend, the following is the code to open IExplorer from Java Program
    class RunTimeTest {
    public static void main(String args[]) {
    try {
    Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.exe");
    catch(Exception e) {
    [\code]
    ALL THE BEST
    Shiva                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Reg. Scenerio Sheets are not importing while importing the model.

    Hi All , Due to some issues , I exported the existing model and then do the isreset before importing the model. I imported the model which i exported. I am unable to see any Scenerio Sheet , planning Sheet in Analysis Workbench which i created earlie

  • BBM stopped working help

    I hadn't updated or backed up my BlackBerry torch 9800 or my 16GB playbook.  Started by taking updates on my phone, all went well. Then I backed up my playbook. When I went to BBM I got the message yourversion of blackberry messenger is not compatibl

  • Is it possible to schedule a room by sending an ics file?

    I'm working on a third party service that creates events and invites a group of participants / rooms to attend those events. I do this by creating .ics files (iCalendar file format) and mailing them (from an outside account) to the participants. This

  • Setting template start mode in java

    In my stylesheet I have templates like this: <xsl:template match="/" mode="query"> <!-- content --> </xsl:template> How do I pass a start mode to my XSLStylesheet in java?

  • Changing country !?

    hey , i have a u.s itunes account with "none" payment method selected  ! then i changed the country to try and use my friend's credit card but it didnt work  then it wouldn't change back to us until i put a valid card ! how can i change without a car