B4J Question JShell - run program with administrator privileges

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hi

I want to launch the tomcat installer from a utility developed with B4J, but it returns an error message because the administrator privileges are missing.
can anyone tell me what parameters should I enter?


B4X:
Sub btnInstallTomCat_Click
    Dim aFile As String     =     File.DirApp & "\" & mFolderDownload & "\" & mFileExeTomCat
    
    Dim shl As Shell
    'shl.Initialize("shl",aFile, Null)
    shl.Initialize("shl", aFile , Array As String("-jar")) ', "Server_report.jar"))
    shl.WorkingDirectory = File.DirApp & "\" & mFolderDownload & "\"
    shl.Run(1000) 'set a timeout of 10 seconds
    
End Sub

Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
    
    Log($"SSH_CmdExecuted at ${DateTime.Time(DateTime.Now)}: "$)
    
    Log("Success " & Success)
    Log("exit code " & ExitCode)
    Log("Stdout " & StdOut)
    Log("strerr " & StdErr)

End Sub

SSH_CmdExecuted at 18:08:02:
Success false
exit code -559038737
Stdout
strerr org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "C:\B4J\works\AGONIN~2\Objects\downloaded\JavaSetup8u251.exe" (in directory "C:\B4J\works\AGONIN~2\Objects\downloaded"): CreateProcess error=740, Per eseguire l'operazione richiesta è necessaria l'esecuzione con privilegi elevati)


thank
regards
 
Top