Loading texture from data path: Access denied
in
Core Library Questions
•
2 years ago
Hello guys!
I'm using TextureIO to load images directly into opengl. Like this:
- import com.sun.opengl.util.texture.*;
- Texture noiseTexture;
- try { noiseTexture = TextureIO.newTexture(new File(dataPath("noise.png")), false); }
- catch (IOException e) { exit(); }
It works fine, when launching from processing. But running the applet in the browser gives:
- java.security.AccessControlException: access denied (java.io.FilePermission null/data/noise.png read)
- at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
- at java.security.AccessController.checkPermission(AccessController.java:427)
- at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
- at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
- at java.io.FileInputStream.<init>(FileInputStream.java:100)
As a solution I tried to load the image first as a BufferedImage and pass this to TextureIO.newTexture. It didn't work. It seems, I can't access any files from the data path using a FIle object.
… any ideas?
1