Added files for compiling as jar.

Added a manifest and two bat files to compile and run the software in a single jar file.
Added checking when reading pokemon to read from jar if necessary.
This commit is contained in:
2017-11-28 13:58:53 +01:00
parent 8860f39f2c
commit cbeca8eb5f
4 changed files with 13 additions and 0 deletions

View File

@ -239,6 +239,14 @@ public class Game {
} catch (FileNotFoundException e) {
System.out.println("You seem to be missing one of the necessary files to run this program.");
}
/** If the file is compiled as jar, this will prevent an empty list. */
if (pokemon.size() < 1) {
try (Scanner file = new Scanner(Game.class.getResourceAsStream("/Pokemon.txt"))) {
while (file.hasNextLine()) {
pokemon.add(new Pokemon(file.nextLine()));
}
}
}
return pokemon;
}