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

Similar Messages

  • How can i open the directory/​folder and read all the files inside it in order and then close it?

    How can i open the directory/folder and read all the files inside it in order and then close it? any example would be nice.
    thanks

    In the File I/O>>Advanced File Functions Palette is a function named "List directory". This function will give you two arrays. One contains the names of all subdirectories the other the names of all files. If you want to sort them by name use the array sort function. If you want to sort them by another attribute use the File/Directory Info function to get more data. Use a cluster which contains the attribut to sort and the original index of the name. Then sort this array.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • How can i open up my i tunes account from my iphone on my husbands mac as he already has 1 set up?

    How can i open up my i tunes account from my i phone on my husbands mac as he alraedy has an i tunes account already set up?

    Welcome to the Apple Community.
    You'd be best setting up a second user account on the computer and then set up iTunes under your user account with your ID.

  • How can I open "Place..." dialog from my plugin?

    Hello All,
    There is a "Place..." item in  "File -> ...". If we can click on "Place...",  "Place" dialog will open and asks for .ai file to place the whatever the art is there in that file in the current document. Right.
    Now what I want is, if I click on one of the button in my plugin UI, "Place" dialog will open and art will be drawn in the current document.
    I looked into the API documentation and found AIPlacedSuite::ExecPlaceRequest( ) function, but no use.
    How can I open "Place" dialog from my plugin?

    The SDK does not provide any calls to open the Place dialog directly.
    You have a few potential solutiuons, however.
    A. Implement your own file dialog box, and use the Place suite. Which I think is perhaps the most elegant solution.
    B. Programitcally create an action that opens the Place dialog. You can record an action that does this to see what file would have to be written (see "Insert Menu Item..." then type "Place", enter while recording). Then you could call the action with the Action suite.
    C. The dialog could be opened using the scripting capabilites (for instance AppleScript). Your program could then write/call the AppleScript. I know it can be done with AppleScript, and I suspect other scripting languages such as Java might be able to do it.
    Hope this helps.

  • How can I open ports on my AirPort Extreme, from WINDOWS?

    I have an Airport Extreme as my router, and I have a Windows-based computer. I need to open ports on the router (ironically, it is for my Apple TV).
    However, even though I can use the Airport Utility for Windows (latest version 5.5.3), I cannot open ports from the application.
    Everywhere I look, I am supposed to have a firewall tab in the Advanced section, but I do not have it. The only tabs that I have in Advanced are:
    Logging and Statistics
    MobileMe
    IPv6
    How can I open ports on my Airport Extreme router from Windows?

    Is your AirPort Extreme the only router in your network configuration?

  • IWorks has disappeared. How can I open documents saved as Word 97 from Pages stored on Dropbox?

    iWorks has disappeared.  How can I open document saved as Word 97 through Pages stored on Dropbox?

    Thanks but I don't think this will help. Like I said, all of my add-ons were working fine and compatible until after running a previous version of FF. I am sure they are still compatible, but they are not working at all.
    I even checked my profile folder and all of the extensions' data is all still there but FF5 is just not reading it correctly. (like adblock plus... I see the folder for it but FF5 doesn't have it on the add-on manager page when I run FF5)

  • How can I open my Illustrator 5.5 (really old!) files in CS5?

    Stupid question, I know, but I know just enough about
    this to be dangerous. I have been using the 5.5 program for
    about 14 years on the same Mac; I just 
    bought a new iMac, and CS5....How do I open those old files?
    Thanks in advance!

    Jacob and Ashuto-
    Thanks to you both! I hadnt selected the proper line in the dialog box when it asked what to use to open the file. I did get the legacy warning, but it opened just fine! Now I get to transfer 14 years of artwork from FLOPPY DISC (!) to flash drives...the advancements are great :-)
    Thanks again!

  • How can I get firefox to execute perl scripts from local files

    I have created perl scripts on my local host (file type ".pl").
    In MS Windows I have associated that type to a perl interpreter installed on my local host.
    IE allows me to create links to them and to execute them (after asking for permission).
    How can I get firefox to do the same? It doesn't seem to allow me to add application types, only to change those that are already defined. As a result, in firefox, they just show up as text, instead of being executed.

    First guess is that you did not use an .html extension on the file. The file may well be ''name.html.txt''
    * see http://www.bbc.co.uk/webwise/guides/file-extensions
    *http://windows.microsoft.com/en-gb/windows/show-hide-file-name-extensions#show-hide-file-name-extensions=windows-vista
    Forum Note
    This is normally offtopic for this forum. I say normally because now we cover webmaker questions. I wonder if this is therefore on topic as a webmaker question?
    I have tagged with webmaker-contribution

  • How can i remove a key and its value from properties file

    hi all,
    i want remove a particular key and associated value from the
    properties file. is their any standard way of doing?
    thanks inadvance
    daya

    hi,
    thanks
    i am able to remove the key,
    one more question how can avoid storing date and time
    in properties file.
    thanks
    daya

  • How can I read only a line of text from a file, line by line using Scanner?

    Here's the code I currently have for a program that finds a keyword from numerous files and prints every line in every file that has that keyword. The keyword is indicated by the first parameter in a command line and the files are every parameter after that. Right now, with the code I have, the program will not print multiple lines of each file if they contain the keyword. I am trying to solve this problem by figuring out a way to have a loop continue until an \n EOL character is found. I am not sure how to do this though. Here's the portion of code that I would like to change to do this. I need to add a condition somewhere after in.hasNext() I think to stop when it it hits a /n.:
    while (in.hasNext()) {
                        count++;
                        String nextWord = in.next();
                        lineOfText.add(nextWord);
                        if (nextWord.equals(keyword)) {
                            flag = true;
    import java.util.Scanner;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    import java.io.FileInputStream;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    public class Find {
        static ArrayList<String> lineOfText = new ArrayList<String>();
        static boolean flag = false;
        public static void main(String args[]) {
                   run(args);
        public static void run(String args[]) {
            try {
                PrintWriter out = new PrintWriter("output.txt");
                String keyword = args[0];
                for (int i = 1; i < args.length; i++) {
                    Scanner in = new Scanner(new FileInputStream(args));
    int count = 0;
    while (in.hasNext()) {
    count++;
    String nextWord = in.next();
    lineOfText.add(nextWord);
    if (nextWord.equals(keyword)) {
    flag = true;
    if (flag == true) {
    System.out.print(args[i] + ": " );
    out.print(args[i] + ": " );
    for (String s : lineOfText) {
    System.out.print(s + " ");
    out.print(s + " ");
    System.out.print("\n");
    out.println(" ");
    lineOfText.clear();
    out.close();
    catch (FileNotFoundException e) {
    System.out.println("file not found!");
    catch (IOException e) {
    System.out.println(e);
    Thanks

    Well, I thought I had this program finished, then I realized I need to match the keyword anywhere in the file(including within a word) and print out each line that "contains" the keyword in each file. So, I need some way of testing to see if the keyword is a part of each word and then flag the line that contains the keyword. Is there some method to do this? Thanks
    Here's the code I have now:
    import java.util.Scanner;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    import java.io.FileInputStream;
    import java.io.PrintWriter;
    public class Find {
        static String line = "";
        static boolean flag = false;
        static boolean flag2 = false;
        public static void main(String args[]) {
                    run(args);
        public static void run(String args[]) {
            try {
                PrintWriter out = new PrintWriter("output.txt");
                String keyword = args[0];
                System.out.print("Searching for the keyword: " + keyword);
                out.print("Searching for the keyword: " + keyword);
                System.out.print("  in files: ");
                out.print("  in files: ");
                for (int k = 1; k < args.length; k++)
                     System.out.print(args[k] + " ");
                     out.print(args[k] + " ");
                     System.out.println("\n");
                     out.println("");
                     out.println("");
                for (int i = 1; i < args.length; i++) {
                    Scanner in = new Scanner(new FileInputStream(args));
    while (in.hasNextLine()) {
    line = in.nextLine();
    String[] splitLine = line.split(" ");
    for (int j=0; j < splitLine.length; j++) {
    if (splitLine[j].equals(keyword) && flag2 == false) {
    flag = true;
    flag2 = true;
    System.out.print(args[i] + ": " + line + "\n");
    out.println(args[i] + ": " + line);
    flag2 = false;
    System.out.print("\n");
    out.println(" ");
    out.close();
    catch (FileNotFoundException e) {
    System.out.println("file not found!");
    catch (IOException e) {
    System.out.println(e);

  • Can't open java control panel or any other .jar file

    Unable to load any .jar file(like jdownloader) or the java control panel .The javaw.exe loads,but the window never open.Maybe it has to do with windows gui?I also got this error:(I don't know if this has to do anything about this-I am a regular user)
    ERROR --- from---log
    sorry, i falsely posted this message
    Edited by: Agosto1990 on Jun 6, 2010 11:13 AM

    Unable to load any .jar file(like jdownloader) or the java control panel .The javaw.exe loads,but the window never open.Maybe it has to do with windows gui?I also got this error:(I don't know if this has to do anything about this-I am a regular user)
    ERROR --- from---log
    sorry, i falsely posted this message
    Edited by: Agosto1990 on Jun 6, 2010 11:13 AM

  • To generate .cab file for windows Mobile from .jar file

    Hi All
    I have a .jar file(running on windows Mobile With J9). Now I want to convert it into .cab file (again must be compatible with Windows Mobile with j9).
    There are some tools available which can convert .jar to .cab file but resulting .cab file is not suppported by Windows Mobile with J9.
    So can any one help me regarding this as soon as possible...
    Thanks with regards,
    nitesh

    hi Rucha,
    The CAB file is available as a part of the ZIP file i had mentioned in my previous posts...
    Unzip that file. Then browse thro the folder structure to the Folder i had mentioned. You'll find the CAB files there.
    Regards
    Ak.

  • How can I open a PDF in my browser without downloading using Nitro Reader 3.5

    I use Nitro PDF exclusively for PDF viewing. I cannot figure out how to open a PDF in the Nitro Browser instead of always having to download everything.
    Not only PDF documents but software updates as well. Nothing opens up without downloading first.

    Hi,
    Please see the support article below:
    [https://support.mozilla.org/en-US/kb/view-pdf-files-firefox-without-downloading-them#w_using-a-pdf-reader-plugin Using a PDF reader plugin]
    You need to ensure that the default Action for opening PDFs is to use the Nitro plugin rather than Saving the file.
    Please let me know if that doesn't help.

  • How can i open my sap in a browser

    Hi all,
    Can anyone tell me how to open a SAP GUI in a web browser.
    I searched SCN but couldnt find any topics related to it. Searched net too with no success.
    So i am posting here.
    Thanks,
    Bala.

    I dont want an application developed to be in browser.
    I want the entire sap gui to come in browser.
    I mean i should be able to see the same SAP GUI in my web browser.
    I know its possible cause i have seen it once but i dont know what url should i type in web browser.
    It starts with
    localhost:(some port number)
    I have sap netweaver abap trial
    Thanks
    Bala.

  • How can i access my playlists on new harley from a file instead of using my actual ipod

    trying to use a backup file to play music on new Harley boom box. will play songs from library but not playlists.

    Hi, you have a lot of questions! Here are some articles that should help - [[Create bookmarks to save your favorite webpages]]. And - [[Profiles - Where Firefox stores your bookmarks, passwords and other user data]]. And - [[Learn more about the design of the new Firefox]].
    To export/import bookmarks: Open bookmarks > Show All Bookmarks > Import and Backup.
    You can bring up the Main menu bar temporarily by pressing Alt, or right click in the tab bar (but not on a tab) and tick/check Menu Bar if you want it to be there all the time.
    The help button is at the bottom of the 3-bar menu (question mark).
    Hope that helps!

Maybe you are looking for