Unable to read a .gif file from a jar

I have made an application which requires some .gif images.
I packed all the classes and .gif's in a jar file.
I have used no package statement in files, all are in one folder.
While retrieving the .gif file from the jar I have used..
Image img1 = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("Lock.gif"));
ImageIcon i1=new ImageIcon(img1,"No Users");
but this does not works and throws nullpointer exception.
I have also tried getClass().getResource() etc.
But none of the methods are working..
Plz. help.
Nimesh

Is the class that is loading the image contained in a package? If the resource name does not start with a forward slash, it is interpreted as relative to the package of your class(when doing getClass().getResource())

Similar Messages

  • To read a gif file from a jar

    I have made an application which requires some .gif images.
    I packed all the classes and .gif's in a jar file.
    I have used no package statement in files, all are in one folder.
    While retrieving the .gif file from the jar I have used..
    Image img1 = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("Lock.gif"));
    ImageIcon i1=new ImageIcon(img1,"No Users");
    but this does not works and throws nullpointer exception.
    I have also tried getClass().getResource() etc.
    But none of the methods are working..
    Plz. help.
    Nimesh

    Hi,
    Use a / with the name of your gif e.g.
    frame().setIconImage((new ImageIcon(getClass().getResource("/myimage.gif")).getImage()));

  • Installation: my adobe elements version 12 is unable to read the raw files from my canon camera 70D.

    my adobe elements version 12 is unable to read the raw files from my canon camera 70D.

    You need Camera Raw 8.2 or higher.
    Elements 12 shipped with 8.1.
    Click Help > Updates to update Camera Raw

  • Reading an xml file from a jar file

    Short question:
    Is it possible to read an xml file from a jar file when the dtd is
    placed inside the jar file? I am using jdom (SAXBuilder) and the default
    sax parser which comes with it.
    Long Question:
    I am trying to create an enterprise archive file on Weblogic 6.1. We
    have a framework that is similar to the struts framework which uses it's
    own configuration files
    I could place the dtd files outside the jar ear file and specify the
    absolute path in an environment variable in web.xml which is
    configurable through the admin console.
    But I want to avoid this step and specify a relative path within the jar
    file.
    I have tried to use a class which implements the entityresolver as well
    as try to extend the saxparser and set the entity resolver within this
    class explicitly, but I always seem to sun into problems like:
    The setEntityresolver method does not get called or there is a
    classloader problem. i.e. JDOM complains that it cannot load My custom
    parser which is part of the application
    Vijay

    Please contact the main BEA Support team [email protected]
    They will need to check with product support to determine
    the interoperatablity of Weblogic Server with these other
    products.

  • Reading external xml files from a jar

    Hi,
    I am trying to read an xml file from a jar (which is not present inside the jar ) .
    I am passing the file name as a string (like C:/folder/filename) to the SAXBuilder but it throwing
    unknown protocol: c error.
    i tried using an url , tried using a relative path but to no use.
    Need help in this regard urgently.
    TIA,
    Regards,
    Harsha

    Hi,
    Actually, my application needs to read two xml files , parse it, perform some operation and write
    the result to an output file.
    The names of the two xml files i mentioned, are specified in a properties file as absolute paths. (I even tried converting them to URIs)
    The xml files are in the same directory as the jar ( i dont know if it should matter as i am giving the absolute path).
    The main class reads the names of the files and passes the names as strings to the SAXBuilder.
    This is where i am getting an exception.
    Going by what you said, is it not possible for a java class to read a fie outside of the jar ? Is there no way to do this ? And right now i am not sure of how to go about this or if there's any work around . Any help would be appreciated.
    Kindly reply at the earliest
    TIA,
    Harsha

  • How to read a text file from a Jar file

    Hi
    How can I read a text file from a Jar file?
    Thanx in advance..

    thanx
    helloWorld it works.damn, I didn't remove it fast enough. Even if it is urgent, it is best not to mention it, telling people just makes them take longer.

  • Unable to read a resources file from my page

    Hi,
    I am trying to read a file from the project resources and I can't have access to the physical file. I have the following code in my page:
    javax.faces.context.ExternalContext ec = this.getExternalContext();
    URL url = ec.getResource("/resources/displayPassengers.xsl");
    InputSource inputSourceXSL = new InputSource(url.toExternalForm());
    InputStream inpStreamXSL = null;
    if (inputSourceXSL.getByteStream() != null) {
    log("Loading xml file: " + url.toExternalForm());
    inpStreamXSL = inputSourceXSL.getByteStream();
    } else {
    log("Unable to extract URL from Page context: WEB-INF/displayPassengers.xsl");
    The url is not null.
    The inputSourceXSL is not null and inputSourceXSL.getByteStream() is always null.
    Please let me know how to access the file.
    Rgrds.

    this should work
    InputSource inputSourceXSL = new InputSource(url.openStream());

  • Camera RAW unable to read Nikon NEF files from D3X

    I have just purchased a Nikon D3X and unable to open the Nikon NEF files with Photoshop
    Mac OSX10.4 Photoshop CS4
    I contacted Nikon support & was advised to instal ACR 5.2
    downloaded the update Camera RAW v5.2 and installed as instructed after removing old plug in & clearing cache. Still wont open NEF files
    I note on the Nikon website that the cameras supported by Camera RAW include D3 but not D3X

    >Mac OSX10.4
    Make certain that is OS 10.4.11.
    >contacted Nikon support & was advised to install ACR 5.2
    Some support!
    As Jao said, you need ACR 5.3.

  • How to read a .wav file from a .jar  - Please Help!!!

    Hello,
    I know this is a stupid question but I keep having trouble doing this. My code is the following:
        Display display;
        Alert alert;
        InputStream stream;
        Player player;
    stream = getClass().getResourceAsStream("newalert.wav");
                player = Manager.createPlayer(stream, "audio/wav");
                player.prefetch();
                player.start();
    ...I'm running this Midlet on a Motorola A1000 and I keep getting the following exception:
    java.lang.IllegalArgumentException:
    stream is null
    I've created the .jad package using KToolBar of the J2ME WTK2.2 with the appropriate .wav file on res folder.
    What I'm doing wrong?
    Thanks,
    Paulo

    Hi
    If your stream is null, then the wav file cannot be reached. Try this code:
    stream = getClass().getResourceAsStream("/newalert.wav");If this doesn't work either, make sure your wav file is directly in the res directory and not in another subdirectory of it. I suggets not running your application directly from the phone until it works from the WTK emulator.
    Mihai

  • Unable to access gif files from the server

    hi all,
    i have successfully signed an applet and it is loading in the client system also. in that applet, i instantiated a jbutton as given below:
    JButton jb = new JButton(new ImageIcon("http://192.168.91.154:8080/success/set.gif"));
    but the icon din appear and a blank button appears, even when accessed from the server system.
    if i give the exact path like c:/blazix/webfiles/success/ set.gif, the icon is coming in the server system but not in other systems. i tried without port no also but in vain. pl solve my problem. what i need is how to
    specify the path of the file[any file] which is present in server.
    or if i put all the gif files in the jar file, can i access the gif files present in the jar file [set for archive] ? if i can, give me the soln for accessing the gif file present in the jar file, so that i need not access the server to get the gif files.(i.e) how to specify the path of the gif files present in the jar file?
    i ve one more doubt. the jni library file shld be in the server, and the client has to access the library in the server. i think the applet loaded in the client ll search for the library in the local m/c only . how to make the applet to search for library in the server??
    i feel only by using rmi we can solve this problem. am i correct? if so i feel that an appln or applet running in the server shld access the jni library, and the applet in the client side should communicate with this server appln using rmi to get the data.is it correct? is there
    anyother way?
    i appreciate your help in this regard. thanks in advance. bye, padmanbhan.

    Better information on what you are doing with JNI might help you get an answer.
    If you have some server process that needs to use JNI, then I would code a servlet to call, instead of using RMI to ge there.
    Depending on your environment, and the target audiences environment, RMI may just cause you a lot of grief. Firewalls etc, get in the way of RMI connections and force security holes to be opened in order to work.
    If you use a servlet, then traffic to your server process is done via standard http calls, which will already be enabled, because your app runs in a browser.
    If ther data requirements are heavy duty, your server could always send an XML stream to the client, which would allow you to describe complex data to the client.
    Running JNI stuff from the client directly means a lot of local infrastructure to run your app. The code you want to run, the JNI library ....
    If what you have is really an application, but want the convenience of starting it from a browser, look at Java WebStart. Then you can distribute an application via the browser, and WebStart will worry about the deployment issues for you.
    In Summary:
    Stay away from RMI from applets if you can help it.
    If you really have an App, then try WebStart to manage the distribution issues for you.

  • Unable to pick up the file from Receive Location

    BizTalk is  unable to pick up the files from receive location.
    My admin console is working so slow.
    It is showing the problem of snap-in as follows:
    I have checked all my receive location and its masking,it is working fine.
    Actually it is working fine in dev server(snap-in problem is not occuring in dev server ) but when I import MSI and binding in UAT server.
    It is not picking up the file from receive location.
    I want to know one more thing :if my message box database is not working fine,will it receive the files from receive location.
    Prakash

    For files not received by receive location. If the Receive Location is still enabled but files are not processed by Receive Location, then check whether the host instance  configured with your receive location is running. If the host instance is in
    running state, restart the host instance and try.
    Regarding the error in the admin console as shown in the image, people started to see this issue with admin console from BizTalk 2009 onwards. This happens in cases like you have done some activity with console and before its been refreshed it you do more
    activities like expanding the node you will see this error. Sometimes WMI is bit slowly to refresh your admin console screen. Just wait for few seconds untill the WMI screen is rendered completely. Ensure you have all the cumulative updates installed for your
    version of BizTalk and also ensure the service pack for your OS is updated.
    Obviously if message box is not working, files will not be received/processed. But if message box is not in healthy state this would affect all other application not just one and in-fact it would affect entire BizTalk not just Receive Locations.
    To start analysing this file not been processed by Receive Location, start with checking the host instance as mentioned.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • "Error: Final Cut Pro was unable to read the movie file just captured"

    Hello everyone!
    We had a computer crash while we were working on Final Cut Pro and backing up some media to a hard drive.
    Since then, whenever we "capture' video footage and hit the escape key to stop capturing - we get -
    "Error: Final Cut Pro was unable to read the movie file just captured"
    We reinstalled the Final Cut Pro software all over again thinking that maybe the software got corrupted and we also rectified any disk permissions for the hard drives.
    Any ideas?
    Thanks
    Efrain
    G 5   Mac OS X (10.4.8)  

    We had a computer crash while we were working on Final Cut Pro and backing up some media to a hard drive.< </div>
    You eventually want to figure out how that happened and make sure you fix it.
    Since then, whenever we "capture' video footage and hit the escape key to stop capturing - we get -
    "Error: Final Cut Pro was unable to read the movie file just captured"
    <
    You reformatted the external drive, yes? You might not have used the correct initialization setting. Should be Macintosh HFS, journalling is optional. Or you have a drive formatted for Winderz.
    Aside from incorrect drive formatting, we have seen this error if the capture is incomplete or improperly terminated.
    It's not an FCP issue, it's hardware.
    bogiesan

  • Unable to read software component version from System Landscape Directory "

    I've worked in past creating/importing SWCV, but this is new system PI7.0 and stuck.
    A) Is my understanding on resolution correct?
    Should I go and apply notes 940309 and create client copy of existing client 001
                                        OR
    change role of client 001; SXMB_ADMIN -> 'Integration Engine Configuration' to 'Integration Server'
    I have no problem in using client 001 as Integration server, all I want is import of SWCV to work. Thanks. Appreciate the help.
    B) Here is what I have done and the error:
    1) Followed weblog below and created product, software component, technical system, business sytem in SLD.
    /people/srinivas.vanamala2/blog/2007/02/05/step-by-step-guide-xml-file-2-xml-file-scenario-part-i
    2) When I import the SWC from integration repository getting error
    (Unable to read software component version from System Landscape Directory "server:5<system number>00").
    C) Pointers used from the forum to debug the issue, but still no luck
    Below are the points checked from the forum and all steps are correct, but still have issues with the import
    1) check the RFCs SAPSLDAPI, LCRSAPRFC, connection test pass as the program ID registered with Jco
    2) T-code SLDCHECK no errors (followed http://help.sap.com/saphelp_nw04/helpdata/de/78/20244134a56532e10000000a1550b0/content.htm)
    3) T-code SLDAPICUST got user PIAPPLUSER, pwd is correct (reset the pwd)
    4) logged using PIAPPLUSER http://server:port/sld and it works
    5) One of the weblog SLD Check Failed (LCR_LIST_BUSINESS_SYSTEMS function doesn't work) referred to apply notes 940309
    Notes: 940309
    You are installing 'SAP NetWeaver 2004s SR1 ABAP+Java' Usage Type 'NetWeaver Process Integration (PI)'.
    You don't want to use the default client 001, but another client as Integration Server.

    applied portion (PIPostInstallProcess) of OSS notes 940309 and it resolved.
    Note:
    I still retained client 001 and didn't do client copy as mentioned in the notes. The wizard based CTC tool helped. Here are the details if someone has similar issue and want to know further details:
    A NetWeaver Process Integration (PI) Installation (ABAP+Java) has two parts: Installation and configuration. The former is done by the Installer, the latter by the 'Central Template Configuration' (CTC) Tool.
    http://help.sap.com/saphelp_nw04s/helpdata/en/14/39084136b5f423e10000000a155106/frameset.htm
    1.      Call the wizard-based configuration tool as described in Configuration Wizard.
           2.      Select the scenario PI and the task PIPostInstallProcess.
           3.      Choose Execute.
    A list of the steps to be executed by the wizard is displayed.
           4.      Choose Install.

  • Unable to install "InstallESD.dmg" file from OS X Mounstain Lion?

    Hi,
    Unable to install "InstallESD.dmg" file from OS X Mounstain Lion, i've downloaded OS X Mavericks and installed on other machine. However, i took backup of "Show Package Contents" before installing.When i try to install ""InstallESD.dmg" file some other Mac machine. When i double click on it its open Packages folder instead of installer.
    Please suggest me, how can i install OS X Mavericks for My Mac machines.
    Thanks in Advance,
    Suresh Balakrishnan.

    Unfortunately with OS X Mavericks you can't use the InstallESD.dmg file as an installer. You have to use either DiskMaker X 3.0.4 or Mavericks Bootable Disk Creation Tool or do an Internet search for the Terminal command that can be used to create a bootable Mavericks installer on an external drive (e,g, USB thumb drive).
    You will need the Install OS X Mavericks.app from the Mac App Store to use with all of the above solutions.

  • 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