Skip to content

Commit

Permalink
fixing the "image not loading inside jar".
Browse files Browse the repository at this point in the history
  • Loading branch information
vmsaif committed Sep 20, 2023
1 parent ce94a85 commit 406bd0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Ant.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Ant(Tile start, Tile goal, int tileSize, Tile[][] tiles) {

private void loadAntImg() {
try {
antImage = ImageIO.read(new File("assets/images/ant.png"));
antImage = ImageIO.read(getClass().getResource("assets/images/ant.png"));
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public Game() {

private void loadFoodImg() {
try {
foodImg = ImageIO.read(new File("assets/images/food.png"));
foodImg = ImageIO.read(getClass().getResource("assets/images/food.png"));
} catch (IOException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit 406bd0d

Please sign in to comment.