Problem in loading images.

I am doing a project. I am creating a jar file which i can execute anywhere. I have some 30 class files in my project.
i am creating jar file by this command
jar cfm IBC.jar *i have not specified manifest file and then after i am modifying manifest file as
Main-Class: Splashscreenwhere spashscreen is my main class.
i have also added image files in my project.
and jar file contains images.
i have created the project using netbeans.
when i build it creates a jar file also in dist directory.
But when i try executing the file which i created manually then it gets executed but i cannot view the images on my forms.
also the class files and image files are in src directory. When i place jar file in src directory and execute it shows images on form but when i change the directory it does not. What can be the problem. Same problem is with netbeans generated file also. Please help me!

Hello there,
To load images to Jars I recommend to you that you follow these methods
JLabel label = new JLabel();
ClassLoader cldr = this.getClass().getClassLoader(); imgUrl = cldr.getResource(" -- img dir -- ");
ImageIcon img = new ImageIcon(imUrl);
label.setIcon(img); In this case the Jars files would make sure that it loads this images.

Similar Messages

  • Problem in loading images when i am connected on company network

    Hi friends, I am using firefox since last 4 months on my windows 8 pro laptop.but since last month I am facing problem in loading images when i am connected on company network but same time it is working fine with ie10. But all these thinks are working well at my home when I am using broadband.

    I don't completely understand your issue. Does this issue occur on 1 network and does not occur on another? Have you tried clearing cache and cookies and making sure your plugins are up to date?
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!
    Please check if all your plugins are up-to-date. To do this, go to the [ Mozilla Plugin Check site].
    Once you're there, the site will check if all your plugins have the latest versions.
    If you see plugins in the list that have a yellow ''Update'' button or a red ''Update now'' button, please update these immediately.
    To do so, please click each red or yellow button. Then you should see a site that allows you to download the latest version. Double-click the downloaded file to start the installation and follow the steps mentioned in the installation procedure.

  • Problem with Loading Images?

    <pre><i>Locking duplicate thread.
    Please continue here: [[/questions/982030]]
    I'm using Firefox 26.0 and I'm kinda new user to Firefox.
    I'm having this random issue with facebook (sometimes with other websites too),
    Sometimes when I open a page, the Images doesn't show as usual.
    Sometimes it takes up to 10sec - 2 mnts to finish loading all the images.
    My internet is 8Mbps so I don't think its due to that?
    Here is a screenshot of the exact issue:
    But it get fixed for a while (say 1-2 days) if I clear the cookies and caches. I visits a lot of webpages so clearing cookies and caches all the times is kinda not pretty possible.
    I also tried disabling all my add-ons, and ran a full scan with McAfee.
    Can anyone tells me what exactly could be the issue? It gets pretty annoying sometimes!
    Thanks in advance!

    '''Hi, Thanks for Visiting this Question. But it was a duplicate of (The Same question) Accidentally posted twice''' and I couldn't find an option to delete it, so please '''ignore''' this :-)
    Original thread: [[|"Problem with Loading Images"]]
    Warm Regards,

  • Problem with loading images dynamically in a pdf document

         I am using live cycle designer and i need to load image from a url dynamically in to the document.For this case i placed an imagefield on my document and i wrote javascript to load image in the form:ready event.
    My script for that was
    imagefield.value.image.href="url".Actually i saw an imagefield in my document but it doesnt carry any image.Please help me to rectify this problem......

    If you save your form as Static PDF, it works.
    But most of the time we need the Dynamic XML form. So, I am also stuggling with this issue.

  • Problem in loading images in JSP

    My JSP page is loading few gif images.
    I am running tomcat 4 connected to apache 1.3.22 using MOD_WEBAPP connector.
    My JSP file loads perfectly alright when I load it directly from tomcat server that is port 8080.
    But when I load it from apache that is port 80, it is taking very long time and not loading images.
    Does anybody has (or had ) the similar problem?
    Please help me

    I'm having the same problem displaying images when I call a jspt hrough Apache 2.0.39 from Tomcat 4.1.3.
    I am using mod_jk as my connector through Apache.
    Did you come up with a solution to displaying images when calling your JSP app through Apache?
    Lenny Sorey

  • Problem in loading images at runtime

    hi ~
    I am facing some problem in making a dynamic flash
    application. Actually i have to loading certain images from a
    remote database at runtime into a pre-existing flash file. i have
    tried it by putting static images and converting them movie clips.
    urgent help required.
    Varun TEkriwal

    you want to load an image? you want to load an mc? first step
    in successful coding is asking the right question.
    and your question was?

  • Problem with loading image

    I cant able to load the image my code is so simple whats the
    problem please help me........
    when me using the image tag its able to load but while using
    from the script its unable to load why??
    but i want it to be loaded in the same
    format..........(D:\images\azshear\SHAR-29-10-2006-21.0.jpg),is it

    You need to use a double slash to escape the source attribute
    in the function. Unfortunately you cannot use the escape global
    method because it ignores the slash character.
    Another way to code this is to use a forward slash instead of
    a double back slash.
    It works for the Image tag because the image tag will escape
    the slash character

  • Problem with loading image to Applet.

    Hello. Im preety new to Java, and currently ive got problems with adding an image to my applet. I tried to make game, similar to Mario - a platform based one. I found a source code of something close to that, and wanted to test but i couldnt get images loading. Here's the code :
    Main class :
    import java.applet.*;
    import java.awt.*;
    public class Main extends Applet implements Runnable{
         Thread th;
         private final int speed = 15;
         private Level obecny_poziom;
         private Image dbImage;
         private Graphics dbg;
         MediaTracker mt = new MediaTracker(this);
         private Image ziemia1;
         public void destroy() {
              // TODO Auto-generated method stub
         public void init() {
              // TODO Auto-generated method stub
              setSize(stale.wielkosc_apletu_szerokosc, stale.wielkosc_apletu_wysokosc);
              //ziemia1 = getImage(getCodeBase(), "g1.GIF");
              obecny_poziom = new Pierwszy(this, this);
         public void start() {
              // TODO Auto-generated method stub
              // create new thread
              th = new Thread (this);
              // start thread
              th.start ();
         public void stop() {
              // TODO Auto-generated method stub
              // Thread stop
              th = null;
         public void run() {
              // TODO Auto-generated method stub
              while (true){
                   catch (InterruptedException ex)
                   // do nothing
         public void paint(Graphics arg0) {
              // TODO Auto-generated method stub
         public void update (Graphics g)
              if (dbImage == null)
                   dbImage = createImage (this.getSize().width, this.getSize().height);
                   dbg = dbImage.getGraphics ();
              dbg.setColor (getBackground ());
              dbg.fillRect (0, 0, this.getSize().width, this.getSize().height);
              dbg.setColor (getForeground());
              g.drawImage (dbImage, 0, 0, this);
    }and Level class that have draw levels from String rows :
    import java.applet.Applet;
    import java.awt.*;
    public abstract class Level {
         //private LevelElement [] elements;
         private WorldTile [] tiles;
         private WorldTile[][] tablica_kolizji;
         private Color [] colors;
         private Component parent;
         private int lewa_granica;
         private int prawa_granica;
         private int dlugosclevelu;
         private Image ziemia = null;
         private Image titi;
         private Applet applet;
         public abstract void resetLevel();
         public Level(Component parent, Applet applet) {
              this.parent = parent;
              this.applet = applet;
              ziemia = applet.getImage(applet.getCodeBase(), "g1.GIF");
         public void initializeLevel(String [] definitions){
              tablica_kolizji = new WorldTile [stale.dlugosclevela] [definitions[0].length()];
              lewa_granica = 0;
              prawa_granica = stale.wielkosc_apletu_szerokosc;
              int licznik_kratek = 0;
              for(int i=0; i<definitions.length; i++){
                   char [] definition_line = definitions.toCharArray();
                   for(int j=0; j<definition_line.length; j++){
                        if (definition_line[j] == ':')
                             tablica_kolizji[i][j] = null;
                        else if (definition_line[j]== 'g'){
                             Ziemia tile = new Ziemia(j*stale.szerokoscTile, i*stale.wysokoscTile, stale.ziemia_id, ziemia, parent);
                             tablica_kolizji[i][j] = tile;
                             licznik_kratek = 0;
              tiles = new WorldTile [licznik_kratek];
              int licznik = 0;
              for (int i = 0; i<tablica_kolizji.length; i++){
                   for(int j=0; j>tablica_kolizji[i].length; j++){
                        if (tablica_kolizji[i][j] != null){
                             tiles[licznik] = tablica_kolizji[i][j];
         public void paintLevel(Graphics g)
                   // draw background
                   // draw all elements in elements array
                   for(int i=0; i<tiles.length; i++)
              catch(Exception ex)
                   // do nothing
    Any ideas why this Image doesnt show up ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    michali7x4s1 wrote:
    Thats a code i found somewhere, tried to check how some things work.Have you used exceptions before? If not, please read the sun tutorial on them as they are very very important. Also, whether this is your code or someone else's doesn't matter as it's yours now, and you would be best served by never throwing out exceptions as is done in this code. It's like driving with a blindfold on and then wondering why you struck the tree. It's always best to go through the tutorials to understand code before using it. If it were my project, I'd do it in Swing, not AWT. Fortunately Sun has a great tutorial on how to code in Swing, and I suggest you head there as well. Best of luck.

  • Problem while loading Image from datat base

    i have sotred iamge as blob in data base while reading from data base and loading i am getting error if image is more than 30 kb
    when i pass bytearrayinputstream to ) but problem is not occure if iamge is less thatn 30 kb (approx) why is it so how to store image is data base and read from the data base
    i want both buffered image as well as SWT Image

    {color:#000080}I tried to read your post but it is throwing a NoPunctuationException.
    Would you care to repost with a few commas and full stops to make it readable?

  • Problem in loading images from ClassLoader

    I m developing a java based application. My application is GUI based. I add an image in a button. This image is placed in jar file. I'm trying to read the image with the help of the class loader, my code goes like this:
    URL aCutImageURL = this.getClass().getClassLoader().getResource("CutImage.gif");
    ImageIcon aCutImageIcon = new ImageIcon(aCutImageURL);
    JButton aBtn = new JButton(aCutImageIcon);
    But, when i try to get the image through the class loader sometimes
    it works properly but sometimes it returns null, throwing a NullPointerException.
    I've also tried to load the image using:
    URL aCutImageURL = this.getClass().getResource("CutImage.gif");
    but the problem is still there.
    Is there any other way to load the images from the jar??
    Please reply soon, its urgent!!!

    Here is a sample code to get an image in a JarFile :
         public static Image getImage(String jarFileName, String fileName) {
              BufferedImage image = null;
              try {
                   JarFile jar = new JarFile(new File(jarFileName), false, JarFile.OPEN_READ);
                   JarEntry entry = jar.getJarEntry(fileName);
                   BufferedInputStream stream = new BufferedInputStream(jar.getInputStream(entry));
                   image = ;
              catch (Exception ex) {
         }I hope this helps,

  • Problem with loading images in flash

    Hi all,
    I am new to flash.
    How can we get .jpeg/.gif/.swf files present in server onto
    the stage dynamically?
    Reply me as soon as possible.... It's urgent.....
    Thanks in advance...

    Create a URLRequest object with the URL of your image. Pipe
    that URLRequest into a new Loader Object. When the Loader Object
    finished loading (add an Event.COMPLETE-Listener to the loader for
    that), you are free to do whatever you want with that Loader. Maybe
    you'll want to draw it in a BitmapData-Object and then go

  • Problem with loading Images from Google

    if i click on one of this pictures & chose open in new tab new windows starts loading, but the loading never ends, in past it use to open this page full screen if i chose open in next tab, & firefox starts to consume a lot of Disk usage when its loading endlessly, whats up with fox? tried that thing with IE to, no endless loading, but kind of like plank page, background same color like u see on the link (dark), but no picture full page dark, & IE has no adds, did google change how this works?, but they are just not finished removing the stuff & that left plank page & fox is unable to load this blank page?, so i guess its not much issue with images, but didn't know how to name the topic
    all my adds, for extra information
    Adblock Edge
    Enforce Encryption
    More In Content UI +

    Test in a similar manner to my suggestion in your memory leaks question [/questions/1048975]
    You are using plugins that are designed to block things and that is probably what is occurring, especially with multiple such plugins.
    See also
    * [[Use the Profile Manager to create and remove Firefox profiles]]
    * [[Firefox uses too much memory (RAM) - How to fix]]
    *[[Disable or remove Add-ons]]
    Additionally also see
    *[[Websites show a spinning wheel and never finish loading]]
    *[[Firefox can't load websites but other browsers can]]
    Must admit I have not got a clue what ms is

  • Problem with loading image in html!!

    my question is
    is it possible to show an image saved as a byte array using <img>
    is there any alternative solutions ........

    yes it's possible.
    No it's not simply a matter of parsing the binary data into your jsp at runtime.

  • Color problems when loading images

    I load card from camera (Canon EOS 700D) and they show fine. But when I hit import the colors go bad and take on a greenish tint. If I hit reset in the develop mode the colors go back to normal. It's a windows 7 PC with Lightroom 5. Colors also show fine on camera LCD.

    Sounds like you are applying a Preset during Import.  Check your Import panel.

  • Problems loading images in JavaHelp

    Using Helpsetmaker to drop the helpset I have had problems with loading images.
    Helpsetmaker keeps any imported images in a pics/<folder>/<folder> heirachy, where the subfolder heirachy is based upon the 'root directory' used to import images.
    The html docs produced are used OK, but the images are not loaded correctly.
    HTML is fine, so the helpset files in general produced by the utility are OK.
    If I move the images to the root of the helpset i.e. the same
    location as the html, & edit the html <img> tags to reflect the new location they are loaded
    correctly so no problems with image files as such.
    AFAIK JavaHelp does not impose restrictions on locating files in subfolders, am I missing something?

    Having had a spare moment to look at the problem again this was a case of seeing what you want to see.
    HelpSetMaker was actually dropping tags src="pics\folder\folder/image.png"

Maybe you are looking for