created a new folder "resources" with all my images in eclipse. I added this folder to the class path.
Now i tried to access this images
URL url = new URL("imageA");
I also tried
URL url = new URL("resources/imageA");
Both doesnt't work. What is wrong?
Sincerely Christian
If you are loading from your classpath you should do something like this
InputSteam is = this.getClass().getClassLoader().getResourceAsStream("resources/myimage.png")
I believe what you want to use are e.g.:
URL Class.getResource(String name)
InputStream Class.getResourceAsStream(String name)
.getResource()
method[java] getResource
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With