CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Invoking DOSPrompt and compiling a java file programatically

    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.


  2. #2
    Guest

    Re: Invoking DOSPrompt and compiling a java file programatically

    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 : [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured