开发者

No read/write access to file on my GWT application runtime (java.io.FilePermission)

开发者 https://www.devze.com 2023-01-29 02:40 出处:网络
I am getting this error on runtime, when trying to run my GWT application: ­java.security.AccessControlException: access denied (java.io.FilePermission C:\\Users\\Admin\\AppData\\Local\\Temp\\tmp-an

I am getting this error on runtime, when trying to run my GWT application:

­java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Admin\AppData\Local\Temp\tmp-andami read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)

(Stack trace is longer, but I guess that this is enough to focus the problem source)

I have searched in Google about this 开发者_高级运维issue and what I have found is, in general terms, to change permissions on java.policy file (located in C:\Program Files\Java\jre6\lib\security), so I did things like:

permission java.io.FilePermission "<<ALL FILES>>" , "read";
permission java.io.FilePermission "C:\Users\Admin\AppData\Local\Temp\tmp-andami" , "read";
permission java.security.AllPermission;

The problem is that in that PATH file or folder "tmp-andami" does not exist (maybe it is hidden), so I dont know if it is a problem of permission or a problem that this files does not exist and therefore can not be read.

All this comes from a line that is written on my code:

private static final String tempDirectoryPath = 
System.getProperty("java.io.tmpdir")+"/tmp-andami";

But I need to write this file, here or in another PATH, I dont care. I have tried to write the file under "C:/" but I got the same result.

Any idea about this issue? Am I doing something wrong?

Thank you very much!


But I am using the access to my filesystem from the "server" package side, not the "client" that contains the translatable code.

I thought it would be possible to do this.

So, what can I do? It should exist a way of accessing local file system, isn't it? Or at least an alternative way of doing the same.

And, what about placing this file under the local deployed app file system? I mean, under "war" directory or something like that. If the browser can access this folder to read .jars and so on, would it be possible to do the same but with another purpose?

Thanks for your help!


GWT compiles your code into JavaScript which runs in the browser. JavaScript does not have access to your filesystem (for good reason).

java.io.FilePermission is not listed in the JRE Emulation Reference so you can't use it in your client-side code, so this shouldn't even be able to be compiled with GWT.


You cannot read or write to temporary files on App Engine. You can read files that were uploaded with your app, but cannot write new files or access any files outside your application.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号