tags:

views:

381

answers:

2

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 run 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?

A: 

There is always the runas command.

BlueRaja - Danny Pflughoeft
this won't work because of two reasons. first it needs the specific admin name for the command options and then it needs to type the password in a blind command line interface... i need some way to invoke the UAC dialog on vista/7 or simply run with admin rights in XP
Savvas Dalkitsis
You will need an administrator name regardless for XP. You can prevent it from asking for the password (except for the first time) using the `/savecred` switch.
BlueRaja - Danny Pflughoeft
A: 

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...

Savvas Dalkitsis