Click to See Complete Forum and Search --> : Invoking DOSPrompt and compiling a java file programatically


August 24th, 1999, 03:40 PM
Hi,
In my application,I want to invoke the DOS-prompt programatically and set"javac filename.java" and make it to compile this file and save the output in a file.I tried using runtime.exec().Its invoking the DOS-Prompt.How can I give the filename(say,test.java)programatically in the DOS-prompt.Can anyone suggest me an idea?.Thatis,in my application,I have a combobox with list of .java files.Wehn the user slects a file and clicks ok button,DOS-prompt should appear and it should compile the file that I
have selected.The user should not touch the DOS-prompt.Can anyone suggest me an idea...I was looking for functions....But,couldn't get it...
Thanks in advance.

August 24th, 1999, 10:28 PM
Just a suggestion.
How did u try to use Runtime.exec() ?
May try sth. like this :
Process proc=Runtime.getRuntime().exec("javac <prog.java>");
DataInputStream inp=new DataInputStream(proc.getErrorStream());
String line;
while((line=indat.readLine())!=null)
{ System.out.println(line); }

Hope this helps.
Regards. Samik.
Email : samikrc@netscape.net