Is it possible to read/write a file from an applet

2019-06-24 03:29发布

I've trying to read and write a file from an applet so if I run the applet from my appletviewer it is possible for me to read/write a file but when I try to do it from my browser I get a security exception. Any idea how to do this?

3条回答
【Aperson】
2楼-- · 2019-06-24 03:52

Is it possible to read/write a file from an applet

Yes, but you need to sign the applet and get approval from the user.

Some useful links:

查看更多
beautiful°
3楼-- · 2019-06-24 03:53

it's actually not that difficult. You can self sign an applet and then it will be able to read/write to/from the local file system outside the sandbox constraints. take look at the link below. it will show you how to sign your applet using the keytool and the example actually does read/write to the filesystem. no need to muck about the policy files and such.

Note that as @aioobe mentioned, the user will be prompted to accept the certificate though.

查看更多
劫难
4楼-- · 2019-06-24 04:16

A sand-boxed JWS app. can read and write to files on the local file system using the JNLP API services. Here is a demo. of the JNLP API file services. The downloadable Zip file contains the source, launch file and build script.

查看更多
登录 后发表回答