Opening html files inside jar

Hi,
I'm making a program where i have a set of help files in the form of html and i would like to open them when the user clicks the "Help" button and I used this code at first
try
     Desktop.getDesktop().browse(new URI("resources/html/help.html"));
catch (Exception ex)
     JOptionPane.showMessageDialog(null, "Could not open help.html in default browser\n", "Error", JOptionPane.ERROR_MESSAGE);
}However after I made the jar and tried to execute on another computer however, it wouldn't work and would display the error message. I was wondering if there was some way that I could open the help.html in their default browser, or maybe a frame if that works, from the jar and have my program still be platform independent?

ok so i just realized that it doesn't make sense for a program outside the jar, like IE or Firefox, to be able to access and open a file inside of the jar. I am now looking for suggestions on how to work around this problem for my program to be able to have a simple help system located inside the jar that can be loaded during runtime.
Thanks for your suggestions.

Similar Messages

  • How Can i open Html file in a Browser from Jar file

    Hi
    i am having Html help files inside my Jar file ... if i use
    getclass().getRource("\lib\start.html");
    it is not opening ... so i have to ship seperate folders for html files along with jar files.... can anyone give the solution to have(open) html files inside the jar file and to open then in a default browser of any OS
    Regards
    Ganesan S

    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

  • Open an html file inside spry collapsible panel

    Greetings,
    Using CS5
    Does anyone know the CSS code/possibility of opening an html file inside the Spry panel?
    I've tried the following code:
    .CollapsiblePanelContent {
        background-image: url(lookoutgraph.html);
    Is there a better CSS element for calling up an html file?
    For what it's worth...the html file I'm tring to open uses a <canvas> tag. When opened by itself, the html file has no problem opening and displaying the canvas data.
    Much Thanks!

    With the exeption of images, to add external content to a document you will need to make use of either serverside or clientside code.
    Have a look at the SpryHTMLPanel here http://labs.adobe.com/technologies/spry/samples/htmlpanel/html_panel_sample.html
    Otherwise, please supply a link to your site so that we can come up with alternatives.
    Gramps

  • Accessing files inside JAR

    Hello !
    I have a HTML file inside a JAR file. The HTML file uses images and stylesheet located in the same dir in the JAR.
    I need to access the HTML file so that I can open it in a JEditorPane for displaying as a normal HTML. I've been trying to access it with some examples i've gotten from the forum from previous posts, without any success. Could someone PLS post me some examples or point me to a webbie with some tutorial.
    I've already tried the following:
    editorPane = new JEditorPane(this.getClass().getResource("/file.html"));Oh, it is a stand-alone application, and all the files are in the same JAR. =)

    Try it this way:
    editorPane = new JEditorPane(ClassLoader.getSystemResource("file.html"));
    -Ron

  • Opening HTML files

    Hi there,
    I'd love someone giving me a bit of help about this...
    AFAIK, Nokia S40 phones can't open an html file stored locally (in the phone's memory or memory card), although they can if that file is accessed through an internet connection.
    So... is there a method or piece of software that I could use to open HTML files stored locally? (I've tried some Java browsers, including Opera Mini, but they all seem only fit for online browsing).
    Thanks a lot,
    Marcos

    ok so i just realized that it doesn't make sense for a program outside the jar, like IE or Firefox, to be able to access and open a file inside of the jar. I am now looking for suggestions on how to work around this problem for my program to be able to have a simple help system located inside the jar that can be loaded during runtime.
    Thanks for your suggestions.

  • Can No Longer Open html files

    I Fireworks 8, I was able to save a web page as a complete
    document to the local drive and then open it with Fireworks to work
    with it. With CS3 all I get is a totally white canvas. I have
    checked that my preferences are all set the same, and they are. I
    use this feature all the time for a variety of functions, i.e.,
    combining slices to make one gif, etc. Am I missing something - or
    is that function no longer there?
    It shows it can open Html files, but it will not even open
    it's own exported html files. Get "internal error." The file is
    fine ( and it just created it.)

    No, it is not a bug at all. It is all about how you do this
    and understand the primary functionality of Fw itself, and how it
    do for you. If you don't fully understand how it works, then you
    have problem trying to understand how it works and what's not.
    Then, perhaps that you clearly do not understand the
    functionality of Fw CS3, and how it relates to exported HTML files
    created by Fw CS3.
    It is very common, wide misunderstanding among other,
    especially with newbies using Fw app, and they thought that if Fw
    could create HTML code. Actually, it was created by side of
    pre-scripted coding inside the app itself, and that it does the
    rest for you.
    As for working with sliced images around Fw CS3, as any
    legacy versions of Fw, the concept of sliced images is often up for
    the air and debates. Everyone have different opinion about sliced
    images, and what not and what's cool.
    I personally dislike sliced images. If having lots of sliced
    images, means slower downloading time and more codes involved.
    I get the feeling that you really not understand how Fw
    works, and how it relates to your question about HTML code in Fw.
    Please try to understand that FW itself CANNOT edit HTML. It only
    just exports html code for you. However, it is important to note,
    it is NOT perfect html code.
    It is best IF you work with pre-scripted HTML code in
    Dreamweaver, or any web authoring app to work with HTML directly.
    If you are not taking my advice, so be it. I am out of this
    discussion. End of discussion!
    And good luck!
    quote:
    Originally posted by:
    lloydtennison
    No. I mean for editing the images. The open command even
    shows html as an option to open, it just does not open the file at
    all. I just creates a new one.
    The reasons for opening an html file in Fireworks have
    nothing to do with Dreamweaver or coding, just images and image
    manipulation. If open html is an option, as it is, it should open
    the file. It used to open with all slices intact, and all html code
    behind it. Now it just opens a white page.
    It is a bug and problem since it does not do as it should.

  • Open html file from Applet

    Hi,
    I need to open html file from applet, the html file is placed in my local system, it is not open. the code is below, please can u tell where i did wrong.
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    <applet code="Resource.class" width="400" height="400"></applet>
    public class Resource extends Applet implements ActionListener
    Button b = null;
    public void init(){
    b= new Button("Click");
    add(b);
    b.addActionListener(this);
    public void actionPerformed(ActionEvent ae){
    try
    URL adress = new URL(getDocumentBase(), "html_code.htm");
    getAppletContext().showDocument(adress, "_blank");
    System.out.println("Execut inside"+adress);
    }catch(MalformedURLException e){
    System.out.println("Eror in Display");
    }

    Don't cross post
    http://forum.java.sun.com/thread.jspa?threadID=633500

  • How to edit a text file inside jar

    Hi all;
    I have a code that created text file and put this file to other jar archive.
    How can I edit this text file inside jar, add string to this file ?
    Thanks,

    Unpack the jar, edit the file, repack the jar.

  • Can't import/open HTML files in Fireworks CS4

    I'm trying to import/open HTML files into Fireworks CS4 to do some redesigning. I inherited the job of redoing my companies website and we believe the person who created our website created the site using Dreamweaver 8. Unfortunatley that person moved on to a new job across the country and we can't ask him exactly how he created our website.
    When I try to open some of the HTML files in FW I get the message: "Could not open the file....Fireworks could not find an HTML table in this file". Next I tried creating a new, very simple HTML page in Dreamweaver CS4 that contains just a few lines of text and 1graphic (we just bought the CS4 web suite). Again, I get the same error.
    Other files give me a slightly different error message when trying to open them in FW, "The HTML document contains one or more images with absolute web addresses for the source. Fireworks cannot handle these images. --click OK-- (next error message) Could not open the file. Fireworks has encountered a problem with the HTML in this table. Verify that the HTML is valid"... and then it closes and nothing loads into FW. Bummer.
    I've searched on these forums and can't find any solutions to this problem although I found a few people experiencing the same problem.
    Do I need to do something to the Dreamweaver created HTML's to get them to open in FW? Any help would be appreciated.

    Fireworks is a graphics editor that can export code; it is not an HTML/code editor.
    If you have exported HTML from Fireworks, you ought to be able to re-import that, but I would think most people who use Fireworks exported code would just modify their Fireworks document and re-export. (Fireworks' code is not robust and it is only intended for mockups and prototypes. Fireworks is not intended for developing and maintaining live Web sites; Dreamweaver is.)
    If your developer used Dreamweaver, then I really don't expect that Fireworks would be able to import that, nor any code that isn't in exactly the format that it can export. If you know your developer used Fireworks, then you need to look for .png files. Fireworks uses an enhanced version of the PNG format for its native document format.
    If you are making small adjustments to your site, then you might be better off working in Dreamweaver. If you're doing a site re-design, then Fireworks is an excellent tool for laying out your design and producing your graphics, but you will, at some point, need to move over to Dreamweaver for coding.

  • How to open html file in forms6i ?

    Hi Guys,
    Can anyone help in out in this regards.How to open .html file in forms6i ?
    Thanks in advance
    raj

    Check out WEB.SHOW_DOCUMENT.
    Regards
    Grant Ronald
    Forms Product Management

  • Open Html file

    How i can write a program can open html file?

    Well I dunno what he meant but I'd like to know how
    to open a html file on my hard-drive from a java
    application.Just like you open any other file on your hard drive.

  • Safari 7.0.5 unable to open html file

    I used to be able to open HTML files in Safari so I can read the content but now it won't let me. Safari 7.0.5. Is there an issue with this version? I am also unable to see some content in our SalesForce app for work. Would a different version of Safari fix this?

    You may have installed "SearchMe" or some other malicious Safari extension.
    From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Remove all extensions with the word "Spigot" in the description. If in doubt, remove all extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those.

  • Html files in jar file

    Hi! i have put some html files in my jar file,but i cant open the html files when i un the jar file.what should i do?

    thnx..it`s working now
    Message was edited by:
    hagi10

  • Viewing JavaDoc HTML files inside a JFrame

    hi all,
    how can I display any of JavaDoc HTML files (as overview-summary.html or index.html) inside a JFrame?
    in addition, the user should be able to use hyperlinks.
    I used JEditorPane, but in it I can't use hyperlinks.
    thanks for your answers. :)

    Hey thats something like a bew browser right if you want to i can send you an example for you but i'm curious you want to use JFileChooser or just open the html page like internet and provide links however send me a message to [email protected] to send you the example and watch if it works for you

  • Retrieving URL for local html file in jar

    I can't seem to load an html file from my jar file. I did
    public URL howtouse=this.getClass().getClassLoader().getResource("howtouse.html");and then added a hyperlinklistener to a editorpane that contained:
    "<a href='"+howtouse+"'>how to use</a>";which opens in the default browser on click:
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
                     BareBonesBrowserLaunch.openURL(e.getDescription().trim());
               }it works, but not in an exec jar file. How can I make it work? thanks!

    Is the jar on the classpath? If not, the file can't be found.

Maybe you are looking for

  • Broken in Logic 9?: Reindex loops from external drive

    Adding loops from an external drive in Logic 9 does not seem to work any longer. It used to work great in L8. Anyone have similar experiences? Know any work arounds? Is it a bug? If it's a bug I'll file it with Apple. Previously in Logic 8 it was eas

  • What is command for full screen preview?

    Hello guys, could please anyone just remind me? Because I haven't use it for a while, I have completely forget what the command is. When I go to View>Video Playback>Digital Cinema Desktop Preview then there is some command which brings Canvas to full

  • Help please on importing pics and Iphoto version

    Hello, I currently have Iphoto 6 (version 6.0.6) and I realized that when I want to import pictures it wont let me select the pictures I want only. it has been inport all them at once. Can I get a new version of Iphot without paying? and do these new

  • Unable to create OLAP Metadata catalog in EIS

    We are planning on creating new Essbase apps using EIS to create and load from our relational data warehouse databases. Have worked with Essbase for many years, but never EIS. We are currently on 9.3.3 for all Hyperion apps. I successfully installed

  • How do i get movies i rented from itunes from my pc to my ipad mini?

    I rented 5 movies thru itunes via gift cards on my pc. I can see the movies on my pc - I can't get them on my ipad mini. I thought the movies would automatically sync and be available to me if I logged in on my ipad. Please help - my trip is in 2 day