Changeset b2d7893 in lost-haven for main/Item.java


Ignore:
Timestamp:
Feb 20, 2021, 6:43:24 PM (4 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
4d8825f
Parents:
a49176d
Message:

Change all file paths to work from inside a JAR and update the makefile to correctly build the project

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/Item.java

    ra49176d rb2d7893  
    1919    this.loc = null;
    2020    try {
    21       this.img = ImageIO.read(getClass().getResource("../images/" + strImg));
    22     } catch (IOException ioe) {
    23       ioe.printStackTrace();
     21      this.img = ImageIO.read(getClass().getResource("/images/" + strImg));
     22    } catch (IOException | IllegalArgumentException e) {
     23      System.out.println("Failed to load image: /images/" + strImg);
     24      e.printStackTrace();
    2425    }
    2526  }
Note: See TracChangeset for help on using the changeset viewer.