This site requires JavaScript, please enable it in your browser!
Greenfoot back
elias.groll
elias.groll wrote ...

2014/4/9

Executables dont work (anymore) ?!

elias.groll elias.groll

2014/4/9

#
Hello guys im workin on a game project for school for 2 months (its really big yet - and im really proud of it :)). But the last time i tried to export the game as .jar, the Panel (of the exported application) couldnt be created (and no exception was thrown too ?!). It still worked before i outsourced the level arrays with "Serializable" (its completely working in the normal greenfoot gui). Please help me fix it because i really Need it exported ! :) Any help is welcome ! :) PS: here is the serialized object:
import greenfoot.*;
import java.util.*;
import java.io.*;
public class Survey implements Serializable
{
    int[][][] level;
    String image;  
    public Survey(String image,int[][][] level)
    {
        this.image = image;
        this.level = level;
    }

    public Survey(String filename)throws Exception{
        Survey compare = load(filename);
        this.level = compare.level;
        this.image = compare.image;
    }

    public void save(File file) throws Exception{
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));
        out.writeObject(this);
        out.close();
    }

    public Survey load(String filename) throws Exception{
        ObjectInputStream in = new ObjectInputStream(Survey.class.getResourceAsStream(filename));
        Survey retVal = (Survey)in.readObject();
        in.close();
        return retVal;
    }
}
and the image of my non-working executabe plus my woking greenfoot project: http://www.pic-upload.de/view-22822224/exception.png.html
bourne bourne

2014/4/9

#
Where are these files being saved to? It must not be within the project's directory to work when exported to a .jar
elias.groll elias.groll

2014/4/9

#
they are saved to the default directory so i think ist greeenfoot's project folder. Do u think ist because theese files arent associated with java by greenfoot? Because the eclipse-packed jar i had for other projects were able to run anyway..
You need to login to post a reply.