

Update: While you can still use the AppBundler described in this article - and in some ways it’s a more obvious approach to building a Mac/Java application - Oracle now recommends building Mac/Java applications with their javapackager tool.

They created an “AppBundler” Jar file that can be used with Ant to build a Mac application, and that’s what I use in this process. Many years ago, Sun (now Oracle) created a process by which you could create a Mac application from a Java Jar file (or even a series of Jar files). The directory must end with the extension, “. If you don’t already know it, a macOS application is actually a directory that contains a series of files in a specific, well-defined layout. More on those later.)Īs those assumptions infer, you won’t have a “perfect” app whose menu items work exactly like a native Mac application, but you will at least have a Mac application that you can start by double-clicking an application icon. (I understand that those first two items can be big assumptions.

SI.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES StdOutPipeRead, StdOutPipeWrite: THandle ĬreatePipe(StdOutPipeRead, StdOutPipeWrite, 0) function GetDosOutput(CMD: string Diretorio: string = 'C:\'): string This page shows an example of how to do this. The above method is functional, but not ideal, another elegant way to do this is to create the process with the CreateProcess ", and redirect the output to a Buffer with the CreatePipe ", basically. Memo1.Lines := ExecutarComando('java arquivo.jar listar') To use: procedure TForm1.Button1Click(Sender: TObject) Until (ExitCode STILL_ACTIVE) or Application.Terminated GetExitCodeProcess(SE.hProcess, ExitCode) SE.lpParameters := pchar('/C' + Comando + ' > output.txt') Something similar to this: function ExecutarComando(Comando: string): TStringList In addition to quoted by Caputo modes, you can use the ShellExecuteEx to run the jar, save to a file and load it into a TStringList.
