How to load a xml file from a package inside of a jar file

hi@all
my application has got a xml configuration file which is saved inside the package tree of the class that reads this file.
when i`m developing using eclipse the class can find that file, everything works fine. but when i create a jar file of my application to use it in another application it cannot find that file anymore.
can anyone tell me how to solve this problem, please?
thx a lot
dialsc

hi all,
the xml file is in the jar file and
ClassLoader.getSystemResourceAsStream(..) solved my problem.
in fact i did nameOfClassInSamePackageAsXmlFile.class.getResourceAsStream("nameOfFile.xml");thank you all
greez
dialsc

Similar Messages

  • Referencing a jre installation inside of a jar file

    Hi,
    I wrote a a small program that executes a JRE.exe installation when executed.
    My problem is that I can't figure out how to reference the JRE installation that I've packaged inside of the Jar file.
    I know that this must have a simple answer but I haven't been able to find one in the tutorials.
    Any help would be apreciated.

    You can't do that. How can expect to execute code in a jar file when the JRE that is needed is IN that jar file? You either have to:
    1) Install the JRE prior to calling your applet or application or
    2) If this is an applet on a webpage, you can run your HTML thru SUN's Htmlconverter which sets up the tags correctly and provides for automatic download of the JRE at runtime.

  • How to load an XML file to oracle9i server?

    I want to use XSU DBMS_XMLsave package to load an XML file to a relational table using PL/SQL from a distant server. Now, I don't know how to load that XML file to the distant server.
    Somebody help me?

    I want to use XSU DBMS_XMLsave package to load an XML file to a relational table using PL/SQL from a distant server. Now, I don't know how to load that XML file to the distant server.
    Somebody help me?

  • How to create an XML document from a String.

    Can anyone help,
         In the Microsoft XML Document DOM there is a load function load(string) which will create an XML document, but now we are switching to Java and I do not know how to create and XML document from a string, this string �xml document� is passed to my program from a webservice and I need to read several xml elements form it in a web server.
    This string is a well formatted XML document:
    <?xml version="1.0" encoding="UTF-8"?>
    <Countries NumberOfRecords="1" LanguageID="en-us">
         <Country>
              <CountryCode>AU</CountryCode>
              <CountryName>AUSTRALIA</CountryName>
         </Country>
    </Countries>

    Thanks PC!
    I made it work using:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    factory.setIgnoringComments(true); // We want to ignore comments
    // Now use the factory to create a DOM parser
    DocumentBuilder parser = factory.newDocumentBuilder();
    //TransformThisStringBuffer is a string buffer wich contain the 'XML document (String)'
    InputStream in = new ByteArrayInputStream(TransformThisStringBuffer.toString().getBytes());
    // Parse the InputStream and build the document
    Document document = parser.parse(in);
    But which one is faster InputSource or InputStream, were would you put the "new InputSource(new StringReader(yourString))" in the above code?

  • How to load 2 xml galleries in single function loop.

    how to load 2 xml galleries in single function loop.
    my function is--------
    var myGalleryXML = new XML();
    myGalleryXML.ignoreWhite = true;
    myGalleryXML.load("gallery.xml");
    function callThumbs()
        _root.createEmptyMovieClip("wall",_root.getNextHighestDepth());
        wall._x = _root.gallery_x;
        wall._y = _root.gallery_y;
        wall.addEventListener(MouseEvent.CLICK);
        var clipLoader = new MovieClipLoader();
        var preloader = new Object();
        clipLoader.addListener(preloader);
            for (i =0; i <6; i++)
            thumbURL = myImages[i].attributes.thumb_url;
            myThumb_mc = wall.createEmptyMovieClip(i, wall.getNextHighestDepth());
            myThumb_mc._x = _root.thumb_height * i;
            myThumb_mc._x = _root.thumb_position = -3100 + (i-j) * 765;
       clipLoader.loadClip("shop/" + thumbURL,myThumb_mc);  // i want to load this  by xml gallery "gallery1.xml"
    preloader.onLoadStart = function(target)
                target.createTextField("my_txt",target.getNextHighestDepth(),0,0,10,10);
                target.my_txt.selectable = false;
            preloader.onLoadProgress = function(target, loadedBytes, totalBytes)
                target.my_txt.text = Math.floor((loadedBytes / totalBytes) * 100);
            preloader.onLoadComplete = function(target)
                new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
                target.my_txt.removeTextField();
                target.onRelease = function()
                    callFullImage(this._name);
                target.onRollOver = function()
                    this._alpha = 100;
                target.onRollOut = function()
                    this._alpha = 100;
        for (i = 0; i < 6; i++)
            thumbURL = myImages[i].attributes.thumb_url;
            myThumb_mc = wall.createEmptyMovieClip(i, wall.getNextHighestDepth());
            myThumb_mc._x = _root.thumb_height * i;
            myThumb_mc._x = _root.thumb_position = -7210 + (i-j) * 765;
            myThumb_mc._y = _root.thumb_position = 180;
            clipLoader.loadClip("banner/" + thumbURL,myThumb_mc);  // i want to load this  by xml gallery "gallery2.xml"
            preloader.onLoadStart = function(target)
                target.createTextField("my_txt",target.getNextHighestDepth(),0,0,10,10);
                target.my_txt.selectable = false;
            preloader.onLoadProgress = function(target, loadedBytes, totalBytes)
                target.my_txt.text = Math.floor((loadedBytes / totalBytes) * 100);
            preloader.onLoadComplete = function(target)
                new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
                target.my_txt.removeTextField();
                target.onRelease = function()
                    callFullImage(this._name);
                target.onRollOver = function()
                    this._alpha = 100;
                target.onRollOut = function()
                    this._alpha = 100;

    combine the two xml files into one if you want to create one gallery.
    if you want two different galleries that display at different times, remove the movieclip wall after you're done with gallery1 and execute myGalleryXML.load("gallery2.xml");

  • How to change value of ${eol} from \n to \r\n, writing by File Adapter

    Hi All,
    How to change value of ${eol} from \n to \r\n, while writing file through File Adapter.
    As my file is being created in Linux environment, so for new line separater, \n is used. I mounted this file directory to windows System.
    As Windows requires \r\n for new line seperator. So I need to change value of ${eol} in the Schema created for file writing.
    Can any one provide help regarding this.
    Thanks in advance

    Hi,
    When an XML payload is written to a file \n would be used as the default line separator regardless of if its windows or linux, as per the XML specification http://www.w3.org/TR/REC-xml/#sec-line-ends.
    As such, one need not worry about the line separators because, the XML file would eventually be processed by a parser which usually would be able to understand both line endings (as they are whitespace characters as far as the parser is concerned).
    If you want to convert the line terminators (for readability etc), 10.1.3.4 has a new feature - in the XML schema definition for the file adapter payload, add these two top level directives to the schema element:
    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
    nxsd:normalizeLineTerminators="false"
    Regards,
    Shanmu.

  • How to get the XML messages from JMS Queue in BPM

    I have one requirement in my application.we are sending XML messages to the JMS Queue.How to get the XML messages from JMS Queue and how to Extract the details from XMl.
    can you please send me the code to get the XML messages from the JMS Queue.
    Thank you,

    Hi,
    Sure others will have some other ideas, but here's what I typically do to get the XML from a JMS queue. Inside the Global Automatic that pops the messages off the queue you'd have logic similar to this:
    artifactInfoNodes as Any[]
    xmlObject as Fuego.Xml.XMLObject = XMLObject()
    load xmlObject using xmlText = message.textValue
    . . . Once you have this, it's a matter of deciding what you want to do with the message. Most times you'll parse the XML (using XPATH statemens), set argument variables and create a work item instance.
    Hope this helps,
    Dan

  • How can I extract certain pages from my document and save as another file?

    How can I extract certain pages from my document and save as another file?

    You would need Adobe Acrobat to do that, not Adobe Reader.

  • I have an alias of one of my external hard drives in my trash. When I click on "show original" all my external H D 's and my Mac hard drive show up. How do I delete this icon from the trash without loosing all my files?

    I have an alias of one of my external hard drives in my trash. When I tried to delete it, it showed that I was deleting 80,000 files and counting. I stopped the delete process and when I clicked on "show original" all my external H.D.'s and my Mac hard drive show up. How do I delete this alias from the trash without loosing all my files? When I tried to drag it back to the desk top, it just made a duplicate and remained in the trash. When I turned off the external H.D., the trash was then empty. Tried rebooting the computer and then turning the external hard drive back on and the alias shows up in the trash again. Much help appreciated.
    Rich

    In Finder's Menu, select Go menu>Go to Folder, and go to "/volumes". (no quotes)
    Volumes is where an alias to your hard drive ("/" at boot) is placed at startup, and where all the "mount points" for auxiliary drives are created for you to access them. This folder is normally hidden from view.
    Drives with an extra 1 on the end have a side-effect of mounting a drive with the same name as the system already think exists. Try trashing the duplicates with a 1 or 2 if there are no real files in them, and reboot.
    If it does contain data...
    http://support.apple.com/kb/TS2474

  • Can anyone tell me how to load my music library from my PC down to my IPad??

    Some how when I updated the OS on my IPad I lost all my music in the IPOD section.  I would like to find out how to load my music library from my PC to my IPad?  Thanks.

    If you use iTunes See Here
    Syncing with iTunes
    From Here
    http://www.apple.com/support/ipad/syncing/
    Ipad User Guide
    http://manuals.info.apple.com/en_US/ipad_2_user_guide.pdf

  • How can I access xml document from javascript whithin a JSP page

    how can I access xml document from javascript whithin a JSP page?
    I have a JSP that receives an XML document from a JavaBean, so I can access it within the entire JSP, but I need to access it from the javascript inside the JSP... and I have no idea how i can do this.
    Thanks in advance!

    The solution would only work on MS IE browsers, as other browsers do not support an XML DOM.
    It can be done, but you would be stuck with using the Microsoft broswer. If that is acceptable, I have some example code, and a book recommendation.

  • How to make Finder NOT to show files from a specific folder in "All My Files"?

    Hello!
    Can someone please advice how to make finder NOT to show files from a specific folder in "All My Files"? See the attach - I recently installed Civilization 5 from Steam and now I have a lot of unneeded files (*.log and *.ini) shown in  All My Files colder in Finder.
    I don't want to see them. Any advise?

    Using "All my Files" was very handy before all this rubbish popped up. =(

  • Reading an XML file from a package .....

    I m trying to read an xml file from a package. The XML file is located on desktop (not on unix system). if i mention the path of the file in a package, is it sufficient ???. OR do i need to CREATE DIRECTORY in oracle and mention the file path in this directory ???
    I have granted CREATE directory permissions...
    If not any suggestion or advice is great ???
    Thank you!!

    BANNER
    1     Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    2     PL/SQL Release 11.1.0.6.0 - Production
    3     CORE     11.1.0.6.0     Production
    4     TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    5     NLSRTL Version 11.1.0.6.0 - Production
    Thank you !!!

  • How do I get files from multiple DVDs that are using thesame file names?

    How do I get files from multiple DVDs that are using thesame file names? Message says "file already exists in catalog"
    Message was edited by: marcr56

    marcr56
    I am viewing your question from different perspective, that is, the issue that you face when you are ripping VOBs from a second DVD-VIDEO on DVD disc using Premiere Elements,
    It is best to give the Premiere Elements version and computer operating system that it is running on. In the absence of that, I will generalize.
    Assuming that you are using
    Premiere Elements 12
    Add Media
    "DVD Camera or Computer Drive"
    Video Importer
    Typically the Video Importer Save In: is C:\Users\Owner\Videos
    Each of your DVD discs is going to have the same names for the ripped VOBs (VTS_01_1.VOB and so on depending on the duration of the movie). Consequently, after the ripping of the first DVD's VOBs and their save to Videos, you will end up with that "files already existing..." block for the ripping of the VOBs from the second DVD.
    The answer is, for each DVD disc VOB ripping, to plan ahead and create and set for different folders in Videos in the Save In field of the Video Importer.
    Please review and then let us know if that works for you. Please do not hesitate to ask if you need clarification on anything that I have written.
    Thank you.
    ATR.

  • How to capture a .gif file from a spectrum analyzer and save the file in PC

    I want to capture a .gif file from a spectrum analyzer and save the file in PC, but I've got a problem when read data from the instrument. I'm not sure how to format the string got from the instrument , When I use "%s" or "%t" as the read string format the data got from the instrument is truncated.
    my code are as follows, could anyone tell me where i am wrong?
    char resultsArray[5000];
    viPrintf(hSpectrumInstr, ":MMEMTORCR 'CICTURE.GIF'\n");
     viQueryf(hSpectrumInstr, ":MMEMATA? 'CICTURE.GIF'\n", "%t", resultsArray);
     printf("%s", resultsArray);
     getchar();       
    Solved!
    Go to Solution.
    Attachments:
    readResult.docx ‏50 KB

    char resultsArray[5000];
    viPrintf(hSpectrumInstr, ":MMEMTORCR 'CICTURE.GIF'\n");
    viQueryf(hSpectrumInstr, ":MMEMATA? 'CICTURE.GIF'\n", "%b", resultsArray);

Maybe you are looking for

  • Sent the wrong laptop

    Hi,     I just returned from my Best Buy store from what I thought was going to be an easy transaction.   It was anything BUT easy. Quite disheartening, actually. On 3/13/15, I received the refurbished laptop that I ordered online,.  I  promptly call

  • My firefox is running very slow and crashes and the curcular thing at the top keeps spinning

    Hi, Recently my firefox has been running very slow. Its take long to browse all websites and sometimes it takes really long when the circular thing at the top left hand corner keeps spinning. When that happens; if I click on the page the screen goes

  • Using sub-report field in cross tab row #2

    I have a sub-report that pulls a product line description that need to be added to row #2 of a cross tab object. I am unable to drag and dropped and it does not appear in the list under the cross tabs expert.  Any assistance would be greatly apprecia

  • Authorization based on Material

    Hi Friends, I want to give authorization to some users only for certain material groups. Normally in PFCG transaction, we can give authorization for purchasing group, plant, company code etc. But I could not find how to control the authorization for

  • Remove password protection

    I want to make some modification to the diagram of a VI which I forgot the password. I went in the VI properties->security and tried either to switch to no password or change the password but LabVIEW prompt me to enter the last password that I forgot