On Jun 4, 4:57 pm, Somu <[email protected]> wrote:
> hi,
>
> I m not able to access local files from my applet...
> i know that JVM is strict about its security aspects.. but is there
> any way by which i can
> access file... atleast files located in my codebase ???
>
> The code i hav written in my public init() is
>
>  fin = new FileInputStream(getCodeBase().getPath()+"abc");
>
> but when i run in browser i get the following exception:
>
> java.security.AccessControlException: access denied
> (java.io.FilePermission C:\Documents%20and%20Settings\Somnath\My
> %20Documents\NetBeansProjects\health\build\classes\abc read)
>     at java.security.AccessControlContext.checkPermission(Unknown
> Source)
>     at java.security.AccessController.checkPermission(Unknown Source)
>     at java.lang.SecurityManager.checkPermission(Unknown Source)
>     at java.lang.SecurityManager.checkRead(Unknown Source)
>     at java.io.FileInputStream.<init>(Unknown Source)
>     at java.io.FileInputStream.<init>(Unknown Source)
>     at NewApplet.init(NewApplet.java:55)
>     at sun.plugin2.applet.Plugin2Manager
> $AppletExecutionRunnable.run(Unknown Source)
>     at java.lang.Thread.run(Unknown Source)
> Exception: java.security.AccessControlException: access denied
> (java.io.FilePermission C:\Documents%20and%20Settings\Somnath\My
> %20Documents\NetBeansProjects\health\build\classes\abc read)
> java.lang.NullPointerException
>     at NewApplet.start(NewApplet.java:70)
>     at sun.plugin2.applet.Plugin2Manager
> $AppletExecutionRunnable.run(Unknown Source)
>     at java.lang.Thread.run(Unknown Source)
>
> pls help
>
You have to sign the applet.
See those threads:

http://faq.javaranch.com/java/HowCanAnAppletReadFilesOnTheLocalFileSystem
http://www.developer.com/java/other/article.php/3303561/Creating-a-Trusted-Applet-with-Local-File-System-Access-Rights.htm

Michèle Garoche
> Somnath B Lohar

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to