I can't build my project

The project, run perfectly, but when i clean & build my project, compiler print this notes:

Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

And when i run the .jar file, this method return error(when run in IDE, not appear this error):

@Override //Override from ImageObserver implements
    protected Object loadResource(URL url) {
        try {
            return ImageIO.read(url);
        }
        catch(Exception e) {
            System.out.println("No se pudo cargar la imagen " + url + "\n"
                    + e.getClass().getName()+" "+e.getMessage());
            
            System.exit(0);
            
            return null;
        }
    }

What’s my problem/error?

difficult to say exactly with the information provided, however the most likely issue it that your images are not accessible.

reasons for this:

  1. you have images as files outside of your jar and your runtime path is not what you expect.
  2. you have images within your jar but you are loading them using file urls.
  3. you have not included the images in your jar but expect them to be
  4. your urls are not correct… try starting the url with a slash… i.e. /images/image001.png instead of images/image001.png

Thats the code in ResourceCache class:

protected Object getResource(String name) {
        Object res = resources.get(name);
        
        if(res == null) {
            res = loadResource("./resource/"+ name);
            resources.put(name, res);
        }

protected Object loadResource(String name) {
        URL url;
        url = getClass().getClassLoader().getResource(name);
        return loadResource(url);
    }

and this the override in SpriteResource class:

@Override
    protected Object loadResource(URL url) {
        try {
            return ImageIO.read(url);
        }
        catch(Exception e) {
            System.out.println("No se pudo cargar la imagen de "+url);
            System.out.println("El error fue : "+e.getClass().getName()+" "+e.getMessage());
            
            System.exit(0);
            
            return null;
        }
    }

The images are in …/Invaders/src/resource/ and when i build the project, i have a copy of resource into dist folder

I have diferents test, put the full path of the directory, put wihtout ./ or wihtout .

but nothing, dont work the distribuible -.-"

Where is the resource folder located in the jar file? Where is the class that is loading the image? The path you have set for resource is a relative path from the level of the class that is trying to load it. Try using absolute path from the root of your source package.

Check your capitalization in your file names. The IDE lets you get away with it, but in a jar it will crash.

I’ve had that problem in the past :P.

However, if that isn’t the problem, can you give us the actual exception? As far as I can tell you have only shown us the code that throws the exception.

Thanks all for help me, i finally can build my project!!!

the problem was, with “/”, when i indicate the localization of images, but now work perfectly and this the result:

http://www.mediafire.com/?x9my8gomy2eear1

The application is not finished, just a test application