|
Duplicate :
|
|
|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
A windows-vista program can advertise that it needs elevated privilege, either by having a manifest files that says so, or being a Windows Installer, or by other means.
If such an executable (such as the java installer) is launched from a command shell, vista will prompt the user to allow running. (all this assumes a normal user with admin privileges)
If the same program is executed using Runtime.getRuntime().exec(), the call will fail with an IOException the 740 error which means:
ERROR_ELEVATION_REQUIRED: The requested operation requires elevation.
java.io.IOException: CreateProcess: C:\jre59234.dat /s /v"/qn WEBSTARTICON=1 INS
TALLDIR=\"C:\Program Files\Java\j2re1.4.2_07\\"" error=740
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at test.execute(test.java:12)
at test.main(test.java:6)
use the following simple java program:
public class Run {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: Run <filename> <arg1> ...");
} else try {
Runtime.getRuntime().exec(args);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
Then type
"java Run jre-6-beta-bin-b59g-windows-i586-06_feb_2006.exe"
(or using any installer executable you have)
|