I am writing a Java Development suite and want to know how I can run the java compiler(dos based) from delphi and display its output messages to a TMemo.
Any help on this will be greatly appreciated!
(I am assuming thet you are writing a GUI for a Third party Compiler) Does your Java Compiler have a command line flag to force it to produce a Log file and/or redirect output to file, as most of (but not all) the DOS 'C' compilers I work with do.
Sometimes they will produce an error log file which I use in one 'C' compiler GUI.
I do not think there is any way you will be able to directly send the output to a memo, If you have a file it's easy to read that into the memo after the compiler has finished.
When I dont have the file option I allow the user to keep the DOS box open, I know this dosent help if the output scrolls off the screen.
Most DOS commands allow you to pipe the output to a file. In a DOS window, if you type
Code:
DIR
, you'll see the directory listing on-screen. If you type
Code:
DIR >tempfile
, a file called tempfile will be created, with the directory listing in it. If your compiler doesn't itself let you log to a file, then you could use this trick and then proceed as Steve suggests. -- Doug Burbidge mailto:doug@ultrazone.com
Thanks Doug
I knew about the redirection thing but I never thought of trying it in a remote call context.!!!!!!!!!!!
One of my embedded compiler GUI's now has the option of writeing it's output to file.
That one has always worked by building a batch file to control the compiler, (another clue for Nephila)
I have yet to try the others which start the compilers directly with calls to Shellexecute/executefile, here the parameters are passed seperatly so I don't know if you will be able to tack the redirection on the end? I will try it.
Thanks guys, but I'm afraid no luck. I tried the output to a text file and that doesn't seem to work, I think because the compiler exits with an error code or something. I've seen a basic Java Editor in Delphi that managed to get this right, but the guy wants cash for the source and I'm not into giving out my hard earned green.
Anyone else with a better solution????
Can you redirect the compiler's output from a command line? If it works from there (just not from Delphi) then you could write a batch file to do the redirection, and then call that from Delphi.
If redirection doesn't work, even from a command line, try piping:
mycompiler /myflags | more
, and see if that does anything interesting.
Or take a look at this VB example, and translate to Pascal as appropriate:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.