There was an error trying to open .jpg
Answered
Hello!
I'm having a problem in which my code is unable to open a .jpg file. I honestly have no idea how to fix this - everything I tried wouldn't work. I would greatly appreciate any help!

Please sign in to leave a comment.
You should put images in the resources directory and load them from the classpath instead, see https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html .
Could you please explain what you mean by that? I don't really understand.
Check out this tutorial with the sample code showing how to load images from the classpath: https://examples.javacodegeeks.com/desktop-java/ide/intellij-idea/intellij-idea-gui-designer-tutorial/ .
icon01 = new ImageIcon(getClass().getResource("image01.jpg"));