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:
parent
8860f39f2c
commit
cbeca8eb5f
1
Compile.bat
Normal file
1
Compile.bat
Normal file
@ -0,0 +1 @@
|
||||
jar cvfm Game.jar manifest.txt *.class Pokemon.txt
|
@ -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;
|
||||
}
|
||||
|
||||
|
3
manifest.txt
Normal file
3
manifest.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Main-Class: Game
|
||||
Name: pokemon-cmd/package/
|
||||
Sealed: true
|
Loading…
Reference in New Issue
Block a user