Trouble loading images

ok i have a java application in which i use multiple images
here is an example of the method i use to load an image:
jlabel.setIcon(new ImageIcon(GridSquare.class.getResource("../images/background.gif")));this works fine when i run it through eclipse, but when i try to package it into a jar, i get a nullpointer from the imageicon.
i assume the problem is in the way i specify the path, but i cant figure out the problem, no matter how much i tweak the url
here is my file system:
(dir)game
---18 classes (all in package game)
(dir)images
---31 images
thanks for the help.

never mind i figured it out.
the problem is somewhere else.

Similar Messages

  • Trouble loading images in Lightroom 2

    I am using lightroom 2 and have had no trouble loading (Raw format) images from my Cannon 50D but I picked up the Cannon G12 and lightroom 2 will not accept images from the G12 in Raw format. It will accept them as jpegs. Any ideas where the problem could be? Would it make a difference to upgrade to lightroom 3?

    Mike,
    Lightroom didn't support the G12 until Version 3.3, so you'll have to do one of two things to use its raw files in LR:
    --Like WW says, you can upgrade. If you're American, I think the upgrade price is about $100.
    --Or you can download Adobe's free DNG converter and convert your raw files to DNGs (which are also raw) that your Version 2 will be able to import.
    Hal

  • Trouble loading images from XML files using AS

    I am creating a slideshow and found a script that will load
    the images via an XML document, but I believe the script is for an
    absolute references image such as <a href="
    http://www.myimages.com/image1.jpg">
    and I want to be able to have them in a file and reference the file
    in the XML such as :
    <pic>
    <image>images/04_02.jpg</image>
    <caption>Soleil Center 4</caption>
    </pic>
    When I test movie I get an error
    Error opening URL "path_to_image/01_02.jpg"
    Is there something I need to change in the AS to be able to
    reference a folder on my desktop (in the same directory as .fla
    file).
    here is the AS code:
    function loadXML(loaded) {
    if (loaded) {
    xmlNode = this.firstChild;
    image = [];
    description = [];
    total = xmlNode.childNodes.length;
    for (i=0; i<total; i++) {
    image
    = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
    description
    = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
    firstImage();
    } else {
    content = "file not loaded!";
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("images.xml");
    listen = new Object();
    listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
    nextImage();
    Key.addListener(listen);
    previous_btn.onRelease = function() {
    prevImage();
    next_btn.onRelease = function() {
    nextImage();
    p = 0;
    this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
    preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
    preloader._visible = false;
    if (picture._alpha<100) {
    picture._alpha += 10;
    function nextImage() {
    if (p<(total-1)) {
    p++;
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function prevImage() {
    if (p>0) {
    p--;
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function firstImage() {
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[0], 1);
    desc_txt.text = description[0];
    picture_num();
    function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    }

    something is still amiss here becuase I placed the xml and
    images at the root level and the images still do not load. I don't
    get any kind of error and Trace tells me the file is being loaded.
    took out the /images/ part so that in the XML it's now :
    <pic>
    <image>07_02.jpg</image>
    <caption>Image Description</caption>
    </pic>
    and here is the AS code:
    var image:Array = new Array();
    var description:Array = new Array();
    function loadXML(loaded) {
    if (loaded) {
    var xmlNode:XMLNode = this.firstChild;
    var total:Number = xmlNode.childNodes.length;
    for (var i:Number = 0; i<total; i++) {
    image.push(xmlNode.childNodes
    .childNodes[0].firstChild.nodeValue);
    description.push(xmlNode.childNodes.childNodes[1].firstChild.nodeValue);
    trace('File Name Value: '+xmlNode.childNodes);
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("images.xml");
    listen = new Object();
    listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
    nextImage();
    Key.addListener(listen);
    previous_btn.onRelease = function() {
    prevImage();
    next_btn.onRelease = function() {
    nextImage();
    p = 0;
    this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
    preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
    preloader._visible = false;
    if (picture._alpha<100) {
    picture._alpha += 10;
    function nextImage() {
    if (p<(total-1)) {
    p++;
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function prevImage() {
    if (p>0) {
    p--;
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function firstImage() {
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[0], 1);
    desc_txt.text = description[0];
    picture_num();
    function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    }

  • Trouble Loading Images in Mail

    When I open an email from a PC user in mail, there is a question mark (blue boxed) in a white box where it appears that there should be an image.
    Thanks!

    Is it marked as "Junk"? If it is, click on "not junk" and the images will load
    LN

  • Loading images using java server page

    I am using NetBeans 4.1 with the latest versions of both the SDK and j2EE sdk.
    OK, all of the JSP and servlets I've done so far have been text only. I am now having trouble loading images.
    I used <img src="images/IMG_0072.jpg" height="50%" width="50%"> to try to load the image, but it isn't working. I have tried various things such as moving the images directory (between having the directory in the same folder as the jsp source files and in the WEB-INF folder)and placing a '/' at the beginning of the path, but to no avail. On viewing the http monitor in Netbeans, I saw no surprises in the request data.
    I have verified that the required images are in the right places, including the war file that Netbeans creates.
    Now I am wondering if the fact that Netbeans puts all the files for the distribution into a war file is complicating my life here.
    It seems to me that my use of the html img tag should not be affected by whether I am using JSP or servlets or plain old html, since in all cases the result sent to the browser is ordinary html (possibly with other, client side stuff that isn't relevant here).
    Can anyone tell me how to solve this particular problem?
    Thanks,
    Ted

    Thanks for the suggestions.
    I tested both, but no joy. I'll have to double check my html.
    I observe that neither test had any impact on the behaviour of the web application. The URI was unaffected, and I still get the 404 not found error. Since I know the image files are there, I don't know why the server isn't finding them, unless I have to do something special because NetBeans 4.1 is putting them into the web applications war file. While I'd expect this to be a faq, as I don't believe I am the first to run into trouble with this, it is an important issue having implications for use of development environments and deploying web applications once development and testing have progressed to the point where deployment is warranted.
    Any other ideas?
    Thanks again,
    Ted

  • Loading images inside the package structure

    i am having trouble loading images that are imbedded into the package structure. I am assuming this is possible(99.9% sure)
    the classes are
    cardgameframework/CardGame.class
    cardgameframework/cardsupport/Card.class
    cardgameframework/cardsupport/images/2D.GIF
    cardgameframework/cardsupport/images/2C.GIF
    how do i load 2D.gif and 2C.gif from CardGame
    i tried
    Image i = Toolkit.getDefaultToolkit.getImage(
    "/cardgameframe/cardsupport/images/2C.GIF");
    and
    Image i = Toolkit.getDefaultToolkit.getImage(getClass().getResource(
    "/cardgameframe/cardsupport/images/2C.GIF"));
    but neither of these seem 2 work
    any help would be appreciated

    My initial thought is that you've got the package wrong in your two examples - you've got cardgameframe and not cardgameframework.
    Anyway, I tend to use the latter of your approaches - getClass().getResource("/cardgameframework/cardsupport/images/2D.GIF").
    Be careful of case in your URLs.
    Note that if getResource can't find your file it will return null - ensure that you're getting back a non-null URL:
    URL url = getClass().getResource("/cardgameframework/cardsupport/images/2D.GIF");
    System.out.println("URL: " + url);
    ...If your URL is non-null then the problem will be with the format of your image file (if it is null then you'll get a NullPointerException eventually).
    Hope this helps.

  • Problem Loading Images

    I am having a little trouble loading images to a slideshow. I
    have all of my paths correct and all of my images named correctly.
    Can anyone help me out on this one. I get this error:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL
    Not Found.
    The code I am using is attached.
    Andy

    I'm not able to see your code. could you please upload it as an online link and send me the link?

  • Using Javascript to rotate images with the style.backgroundImage property & I leave the onload pg & return, the images have trouble loading.

    I'm using Javascript to rotate background images -->
    function rotateImages() {
    setInterval("startRotator()", 7000);
    var counter = 0;
    function startRotator() {
    var images = ["images/finance1.jpg","images/finance2.jpg","images/finance3.jpg","images/finance4.jpg","images/finance5.jpg","images/finance6.jpg"];
    if( counter >= images.length ) {
    counter = 0;
    var image = "url('" + images[counter] + "')";
    counter++;
    document.body.style.backgroundImage=image;
    The script is triggered by the load event when the homepage loads and the script only runs on the homepage. Everything works fine upon opening the homepage.
    If I leave the home page and return, the images will have trouble loading for about 3 to 5 cycles and I'll get white backgrounds for part of the time. The same thing happens if I enter the site from a page other than the homepage and then go to the homepage.
    I discovered, however, that if I enter the site at the homepage and then leave the homepage and return using the back button, everything runs fine. Apparently it then accesses a cached version of the homepage? Seems having two cached versions creates a conflict?
    This problem only happens with Firefox (I have ver 29.0.1). It does not happen on IE ver 11, Chrome ver 34, or Safari ver 5.1.7.
    I get the same problem with XP, Win7, and Win8 but, only on Firefox.
    Can you please fix this?

    Hey, I am trying to reproduce this here: [http://jsfiddle.net/u3TLb/]
    Mozillazine forums and the [http://webcompat.com] are more specialized in Web Compatibility, please ask there as well.

  • Hi, I have trouble loading my iPhone 5 photos into Aperture. The iPhone icon appears in the import window, but the images won't show up in the loading window.

    Hi, I have trouble loading my iPhone 5 photos into Aperture. The iPhone icon appears in the import window, but the images won't show up in the loading window

    The iPhone icon appears in the import window, but the images won't show up in the loading window
    Do your images show, if you disable the option "Do not import duplicates"? If yes, then check, if the images have already been imported, eg. using Photo Stream, if you are using Aperture 3.3 or later.
    Aperture 2, Mac OS X (10.6.8)
    Is your profile signature above still current?

  • I have a macbook air and have trouble getting images to load on ebay, many blogs

    i have a macbook air and have trouble getting images to load on ebay, many blogs and also pinterest. What can I do to improve performence?

    this is not normal but try to see the multiples accounts in the mail check if his account is not connected yet

  • Internet Explorer 7 - Trouble loading iWeb 08 Pages

    Is anyone else having trouble with iWeb 08 pages not loading properly when viewed in Internet Explorer 7?
    Everything loads fine on a Mac (Firefox 2.0) and even on a PC using Firefox but when viewing the site from IE7 it seems like pages containing photos (ie photo pages and blog entries) are having trouble loading completely. The images never appear or some images appear or some thumbnails fail to appear in the new photo gallery page.
    Solutions? Work arounds? Or is this just a bug that needs to be repaired in an upgrade?
    I love the Mac but the new iWeb and iPhoto seem a little glitchy out of the box.

    mtd,
    I tested your site on my PC with IE 7. No problems. In fact I tested load times for both Safari (Mac) and IE (PC) and they were almost identical. I compared screens side by side and they looked the same. Some of you may not have updated versions of IE. Additionally the IE browser settings can be a bit tricky. You know, it's MS so troubleshooting is a given! One suggestion is to delete all the cookies currently running in IE 7 and give it another viewing.
    I have noticed that some themes slow down both browsers. It's a matter of complexity of the theme.
    All the Best,
    http://artotems.com/default.aspx
    http://web.mac.com/catucker/InsideOutside/Blog/Blog.html

  • Why do some webpages not finish loading images when using cellular data instead of WiFi?

    I'm using iPhone 6 64gb. The problem existed with iOS 8.0.0 and the iOS 8.0.2 update.
    I have had trouble with webpages loading slowly over AT&T LTE. Sites with multiple images frequently have trouble loading all the images entirely. Instead, the unloaded portion of the image fills in with black or the image fails to load at all. If I switch to WiFi when available and refresh the page, the images will usually reload completely. I never had this problem with the iPhone 5s on the same websites.

    I'm on AT&T with an iPhone 5 first gen. This problem is happening across iPhone4s al of the way to iPhone6+
    Thought it was only affecting newer iPhones with new Graphic Processors but I later ruled that out.
    Seems to only be happening on LTE / 4G. Is not affected on WIFI for me.
    I clear cache, crash browser and even reset the phone but will still get unexpected results in LTE or 4G.
    The images seem to be getting prematurely cached and are only partially rendering.
    When I save the these half loaded images in photoshop I get a warning that they are damaged and/or truncated.
    I have saved images out as PNG and JPGs renders poorly.
    About the images-
    These images are only 15k and there are 16 on the page so I can't see why they would get bottlenecked when loading.
    also, there is no background-color of black anywhere in the CSS.
    Note the TV-Like static on the bottom image similar to the comment  ryzer08 above.
    NEXT IMAGE.....

  • Problem loading image into texture memory

    Hi there, I am currently porting our new casual PC game over to the iPad using the pfi, the game was written in Flash so the porting process isn't that hard thankfully, it's mainly just optimizing the graphics.
    So far things are going smoothly, I was initially worried about graphical performance, but since we put everything into the GPU that's no longer a concern- it runs super smooth at 60fps at 1024x768, we can have a hundred large bitmaps rotating and alphaing at once with no slowdown.
    However there is one weird problem which is really worrying me at this point- it seems that the speed at which images are loaded into video memory as textures is vastly different depending on what else is being run on the iPad, for example:
    * If I run my game with nothing else in memory, it will run fine at 60fps, and load up large images into texture memory very fast.
    * If I run another App, in this case a Virtual piano app for a while, then close that App via the Home button (so the piano app is still in memory but suspended due to the multitasking), then when I run my game, it will run ok initially, but when I try to load a large (1024x512) image into texture memory it pauses the whole game for several seconds.
    * To make matters worse, if I repeat the same test using the RAGE app from ID software (which is very graphically intense), my game actually slows down to 1 fps and runs extremely slowly as soon as I run it and the frame rate never returns to normal. If I then double-click the home button, shut down RAGE, then go back to my game, it will run fine.
    I have read that sometimes when you load images into texture memory it will have to reclaim that memory from other apps, but that doesnt exaplain why it slows down every time I want to load something, or why the game would slow right down to a crawl.
    So then it seems that having other Apps in memory is slowing down my game, or stopping it from working altogether. Obviously this is not ideal and would stop us from releasing, so is there any way I can stop this, has anyone come across the problem? Please help!
    PS. this problem also happens on an iPhone 4, as I have performed the same tests.

    Hi _mz84
    First thing I noticed, is that you did not close your
    <embed> tag
    <embed src="gallery1.swf" bgcolor="#421628" width="385"
    height="611" wmode="transparent" />
    If that doesn't solve your troubles, try the following
    container.
    <object type="application/x-shockwave-flash" height="611"
    width="385" align="middle" data="gallery1.swf">
    <param name="allowScriptAccess" value="never" />
    <param name="allowNetworking" value="internal" />
    <param name="movie" value="gallery1.swf" />
    <param name="quality" value="high" />
    <param name="scale" value="noscale" />
    <param name="wmode" value="transparent" />
    <param name="bgcolor" value="#421628" />
    </object>
    hope this helps out.

  • Problem loading image from HTTPS

    I am having trouble loading an image in Java client , the image is coming from a secure server.
    My code looks as follows
    Image image = null;
    try
    // just substituting my image with the secure image I found on sun site
    URL url = new URL("https://www.sun.com/im/sun_logo.gif");
    image = getToolkit().getImage(url);
    catch(MalformedURLException e )
    System.err.println("invalid URL");
    if (image == null)
         System.err.println("null image");
    MediaTracker mediaTrack = new MediaTracker(this);
    try
         mediaTrack.addImage(image, 0);
         mediaTrack.waitForAll();
    } catch (InterruptedException ie)
    System.err.println("Interrupted Exception");
    if (mediaTrack.isErrorAny())
    System.err.println("Error loading the image");
    Initialy I got MalformedURLException but then I switched to jdk1.4.2 and set the following system property and got passed that part but now I am getting error when MediaTracker tries to load the image.
    System.getProperties().put("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
    I need to know if there is a better way of loading the image and if possible without having to set the system property.
    Thank you

    Have you tried using the HttpsURLConnection class introduced in JDK 1.4?

  • Premiere Pro CS6 Quits unexpectedly when loading Images or Video into viewer.

    I have been using CS6 since May of 2013.  I currently operate on a Mac. I have never had any issues. I used it one day last week, then all of a sudden a few days ago is when the issues started. Premiere Pro will start normally (New or Exsisting Project), I can even import media. But I am not able to load Images or Videos into the viewer, nor am I able to just drag and drop on the timeline. Audio seems to drag onto the timeline just fine.
    I have tried many things to trouble shoot the issue such as:
    1. Starting a new Project. (Thought maybe something in the existing project was corrupt.)
    2. Opening an older project that I knew worked fine in the past. (Thinking new projects were also corrupt.)
    3. Transcoding the video Files. (Thinking the media was corrupt.)
    4. Restarting the computer.
    5. Holding "Shift" while starting Premiere Pro.
    I am not getting any error codes, just a Dialog box that says, "Sorry, a serious error has occurred that requires Adobe Premiere Pro to shut down. We will attempt to save your current project."
    Thanks for your help.

    Hi Luther,
    Welcome to Adobe Forums.
    Which version of Mac OS are you using?
    Try to repair the preferences by opening the finder window click on go and
    choose go to folder and type ~/library and press enter. Then go to Preferences>Adobe
    and rename the 6.0 folder to 6.0.old. If you are using Mavericks ( OS 10.9) try to give permissions to the
    Adobe folder as well.
    Please reply in case the issue persists.
    Thanks

Maybe you are looking for