Question

I'm making a java application using LWJGL. When exporting the project into jar and signing it, it crashes when I'm trying to open a file like this:

    File file;
    try {
        file = new File(getClass().getResource(map_filename).toURI());
    } catch (URISyntaxException e) {
        e.printStackTrace();
        return null;
    }

You can check the applet here: http://www.cs.tau.ac.il/~vladis2/LD23.html it crushes right after you click the play button. The whole code it here: http://www.cs.tau.ac.il/~vladis2/LD23.zip maybe you can find the bug, even that I'm pretty sure it is something about premitions, but I did sign it and it works fine until I'm trying to open the file from the jar.

If you want to compile it your self you will need the externals: http://www.cs.tau.ac.il/~vladis2/lwjgl.rar

So what is causing the applet to crush?

Please help as quick as possible. Thanks.

Was it helpful?

Solution

You can't use a File to read files from a Jar, you need to use an inputstream, hence the failure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top