Im trying to load an image from my project directory into a BufferedImage resource, but getting an error stating that it cannot load the image. Here is the line providing the error:
final BufferedImage plusMinusIcon = ImageUtil.loadImageResource(CalculatorProPlugin.class, "plus_minus_icon.png");
And here is the error I receive when trying to build:
net.runelite.client.util.ImageUtil - Failed to load image from class:
...plugins.calculatorpro.CalculatorProPlugin path:
...plugins.calculatorpro/plus_minus_icon.png
The image is saved in the projects directory, and if I copy the path to "plus_minus_icon.png" from the directory, I get "...plugins.calculatorpro\plus_minus_icon.png", so it matches what I put in the code
WORKING ANSWER: Using Frakcool's suggestions from below, he helped me to create a working solution:
InputStream inputStream = CalculatorProPlugin.class.getResourceAsStream("/plus_minus_icon.png");
BufferedImage plusMinusIcon = null;
plusMinusIcon = ImageIO.read(inputStream);
With my icons stored in a resource folder within the project directory: