开发者

Java admin rights (UAC)

开发者 https://www.devze.com 2022-12-17 05:35 出处:网络
My application consists of a server a and client interface. I want the client to be able to request the server to write a registry key. Now i did my research on libraries for java that do that and i f

My application consists of a server a and client interface. I want the client to be able to request the server to write a registry key. Now i did my research on libraries for java that do that and i found a few. The problem lies with admin rights. When i run a simple java program to read from the registry i get an error that informs me that i don't have sufficient rights. I am guessing it has to do with UAC in vista and 7 but the same problem also occurs when i run the program from windows XP.

Is there a way to run my server program with elevated rights so that when the client requests a registry update, the server will run it with no problems? (right click ru开发者_如何学编程n as admin is not an option i'm afraid)

EDIT :

What my question actually boils down to is whether there is a way to launch a jar file as an executable with elevated permissions. I mean something as simple as that should be available no?


There is always the runas command.


I found a "hacky" solution to this problem. I create a shortcut to the java.exe program, modify it's target to pass parameters that launch my jar and then simply tick "Run as administrator". But i still think that there should be an option to launch with elevated rights for jars...

0

精彩评论

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

关注公众号