I'm trying to read a folder in a jar file, it works fine when it's not in jar format, however when i jar it, it returns a nullpointerexpcetion since it's not able to find the files nor the directory
So, here's the method i have....
public void preloadModelsTwoOLD() {
String slash = System.getProperty("file.separator");
File file = new File("."+ slash +"Patches" + slash+"Models"+slash);
File[] fileArray = file.listFiles();
for(int y = 0; y < fileArray.length; y++) {
String s = fileArray[y].getName();
if (s != "") {
byte[] buffer = readFile("."+ slash +"Patches" + slash+"Models"+slash+""+s);
Model.method460(buffer, Integer.parseInt(getFileNameWithoutExtension(s)));
//System.out.println("Read model: " + s);
}
}
}
Basically this is in a java file inside the jar and the jar has this directory that has the files i need it to read
file.java is in main folder main folder/classes/patches/models but the class file reads from the classes folder so i have it like this ./patches/models/+i+.dat
any ideas as to why it's not reading it properly and how to go about fixing it so it'll work when in jar format if not both formats? any help is appreciated.