Hello Greenfoot Community
While trying use an .ini File to store and load Data from, i ran into some problems. Maybe some can help me out with this...
I know that a cant access Files the "normal" way and used the method explained herehere .
I wanted to use the ini4j api to access said file and did a first try with the example dwarfs.ini.
This is what i tried:
Thanks in advance
Crydsch
public void ini()
{
try{
InputStream input = getClass().getClassLoader().getResourceAsStream("data/dwarfs.ini");
Wini ini = new Wini(input);
Ini.Section section = ini.get("happy");
String age = section.get("age");
String weight = section.get("weight");
String homeDir = section.get("homeDir");
getWorld().addObject(new Text(age + " - " + weight + " - " + homeDir), 32*5, 32*5);
//System.out.println(age + " - " + weight + " - " + homeDir);
}catch (Exception e){
getWorld().addObject(new Text(e.toString()), 32*5, 32*5);//System.out.println(e);
}
}
