Hi, I was wondering if any of you guys could figure out what is wrong with this line of code:
I can guarantee that the file location is right, so I'm not sure which part of it I'm doing wrong.try { frame.setIconImage(ImageIO.read(frame.getClass().getResource("C:\\Users\\John\\Downloads\\calcicon.ico"))); } catch (Exception e) { e.printStackTrace(); }
Here is what the exception is:
java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)
at JFrameClaculator.Calculator.createAndShowGUI(Calcu lator.java:524) //*
at JFrameClaculator.Calculator.access$0(Calculator.ja va:63) //**
at JFrameClaculator.Calculator$1.run(Calculator.java: 31) //***
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
* = The line I mentioned above
** = private static void createAndShowGUI() {
*** = createAndShowGUI();