I am working on a personal project for fun and trying to load images onto JFrame using ImageIcon. I'm getting the error: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null.
I've tried adding the path, just the file name, and other combinations but still getting the error. I created a class and I'm calling it in the main method. This is the block of code I have that is giving me the error:
front = new ImageIcon(getClass().getClassLoader().getResource("/target/classes/com/front.png"));