Reputation: 1
It was working ok until I updated java to version 51. NoW it gives me a NullPOinter exception.
I am using Aplet.class.getResource("image.jpg")
to load the image, but now it doesn't work.
I have Folder called Applets, inside are the .class files from the applets and Images folder and I have index.html file with this code
<applet codebase="Applets" code="Applet1"></applet>
Now this was working fine before the update
Upvotes: 0
Views: 59
Reputation: 6242
Is the image in the jar or are you loading it from the context of the page? According to this blog: http://www.duckware.com/tech/java-security-clusterfuck.html You should better use getResourceAsStream.
You must place all possible files inside the JAR, and use
the Class.getResourceAsStream() calls to access. If you
need to access any files outside the JAR, Oracle has
screwed you over
Upvotes: 1