java1.6のvistaにソフトウェアをインストールするsetup.exeインストーラーを実行したい。
ユーザーは管理者ではありません。プロセスを開始しようとすると、エラーメッセージが表示されます。
CreateProcess error=740
これは、ユーザーがプロセスを開始するための十分な権限を持っていないことを示しています。
プロセスを管理者権限で実行する必要があることを示すフラグまたはオプションを送信できますか?Vista自体には、メニューツールバー内にこの機能があります。この関数をJavaで使用できますか?
私は次のコードを呼び出します
Runtime rt = Runtime.getRuntime();
Process process;
try {
String fileToExecute = new File(mFolder, mSetupFiles[0]).getCanonicalPath();
if (logger.isDebugEnabled()) {
logger.debug("Execute runtime process");
}
process = rt.exec(fileToExecute, null, mFolder);
process.getErrorStream().close();
process.getInputStream().close();
process.getOutputStream().close();
if (logger.isDebugEnabled()) {
logger.debug("Wait until process is finished");
}
process.waitFor();
} catch (IOException e) {
throw new StartException(e);
} catch (InterruptedException e) {
throw new StartException(e);
}