java - JavaFX image nullpointerexception -


i'm trying declare image object, nullpointerexception every time try use it. constructor:

final image systemsecureimage = new image((getclass().getresource("images/notifications/systemsecure.png")).tostring()); 

when try use in method, throws error. example...

sample.samplemethod(image); 

any idea i'm doing wrong? i've tried 2 other ways:

image systemsecureimage = new image("images/notifications/systemsecure.png"); image systemsecureimage = new image("file://images/notifications/systemsecure.png"); 

the image's constructor needs external form of resource path.

final image systemsecureimage = new image((getclass().getresource("images/notifications/systemsecure.png")).toexternalform()); 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -