开发者

i have a shared folder on a server where i want to create files and subfolders with java?

i have a shared folder on a server where i want to create files and subfolders with j开发者_StackOverflowava. The problem is with the permissions. How can i set a user thorugh my code that can create folder in shared drive.


You can try to run your code as the common user.

runas /user:%USER% /savecred /env "CMD /K %JAVA_HOME%\bin\java %JAVA_OPTS% -jar \"myapp.jar\" %JAVA_ARGS%"

To do this, you need to create a user with the same name an password on you development maschine. That user should be able to write onto your folder.

EDIT: I'm pretty sure, there is no capability build in with Jave to set an Windows ACL with java.io If your common user as the permissions to change permissions of your created folders and files, you may run Runtime.exec("some windows commandline code, to change ACL")

If your common user doesn't have the permission, my answer is "You can't".

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜