1

new to java here.

I have a java project in netbeans 12.2 using javafx and I want to load an image from a resources folder into a javafx image object.

I have the following code:

Image image = new Image( "/resources/splash.jpg", 32, 32, false, true )

But I am getting the following error:

java.lang.IllegalArgumentException: Invalid URL or resource not found

So I think the path I'm trying to use is incorrect, can someone please help me find the correct path? My folder structure is as bellow

my java project folder structure

Tamjid
  • 4,326
  • 4
  • 23
  • 46

1 Answers1

0

Try

Image image = new Image("resources/splash.jpg", 32, 32, false, true)
ChubsB
  • 1
  • 1