Load image from jar/working directory


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. private BufferedImage loadImage(String path) {
  2. try {
  3. return ImageIO.read(this.getClass().getResource(path));
  4. } catch (IOException e) {
  5. return null;
  6. }
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.