5
Hello, I have a program where I need to every run of it, go on the server, pick date and time, and change on the local PC.
I am running the following command line:
Runtime.getRuntime().exec('DATE '+dataServidor.trim());
and JAVA returns me to the following Exception:
java.io.Ioexception: Cannot run program "date":
I circled the command line by own CMD, and returned me the following result:
The client does not have the necessary privilege
But when I run the command line on CMD as an administrator, it performs normally and changes the date...
So I believe I need to execute the Runtime.getRuntime(). exec() as an administrator too, but I don’t know how to do!
It would be wrong to be able to execute things as an administrator... it would be flawed, already noticed that when it goes to install a program that needs privileges it asks permission? then... only with permission at all
– Anderson Henrique
Elevate Java application while running
– user28595
Just run the parent process as administrator, all the privileges will be passed automatically.Run the JAR as administrator, the command will work.
– Pedro