Results 1 to 4 of 4
  1. #1
    ki_ha1984 is offline Member
    Join Date
    Aug 2011
    Posts
    79
    Rep Power
    0

    Default Change the package error

    Hello,

    I have a problem with a class which has the next code.

    Java Code:
    initComponents();
            ImageIcon winIcon = new ImageIcon(getClass().getResource("images/setinterface.png"));
            this.setIconImage(winIcon.getImage());
    When i transfer the class to other package in same project, give me the next error.
    It is something like that cant find the pictures, but the pictures are in the same folder and project.

    Java Code:
    Exception in thread "main" java.lang.NullPointerException
    	at javax.swing.ImageIcon.<init>(ImageIcon.java:205)

    An idea

    thanks.

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

    Default Re: Change the package error

    Smartly load your properties - JavaWorld
    Class (Java Platform SE 6)

    "/"-separated names; leading "/" indicates absolute names; all other names are relative to the class's package

  3. #3
    ki_ha1984 is offline Member
    Join Date
    Aug 2011
    Posts
    79
    Rep Power
    0

    Default Re: Change the package error

    after this if i remove the previous package the class in the package will be work ???

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: Change the package error

    Quote Originally Posted by ki_ha1984 View Post
    after this if i remove the previous package the class in the package will be work ???
    What happened when you tried it?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Compiler runtime package load error
    By Dark-Redd in forum Advanced Java
    Replies: 17
    Last Post: 10-09-2011, 10:21 AM
  2. error with package
    By afreaz in forum New To Java
    Replies: 20
    Last Post: 12-16-2010, 07:20 AM
  3. I got an error message when using package in Textpad
    By magicianseeker in forum New To Java
    Replies: 5
    Last Post: 12-09-2010, 04:57 AM
  4. package does not exist error
    By glaze24 in forum New To Java
    Replies: 1
    Last Post: 11-28-2010, 03:03 PM
  5. why I get error while trying to run a class in a package
    By newlifeseattle in forum New To Java
    Replies: 4
    Last Post: 06-01-2010, 08:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •