Results 1 to 2 of 2

Thread: ShellExecute

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    The Littlest State in the Union
    Posts
    57

    ShellExecute

    Shell question
    I am making a GUI for sun's java compiler. My question is that i want to call the dos prompt and automaticaly type in javac filename, that i can do that using the shellexecute api function. But if there is an error in the compile it will list the error(s) but close the window before you can look at it, but i want to keep the prompt open.

    If you understand any of that and can provide help thanks in advance

    -BFF
    Visual Basic 6.0 Enterprise Edition
    Java 2
    Windows 98
    Mac OS 9.1

  2. #2
    WALDO
    Guest
    The simplest way to do this is to programmatically create a batch file that spools uotput to some text file, then read it into your app.

    Your batch file would look something like this:

    javac <filename> >output.txt

    The >output.txt is the most important part. It will spool the dos(cmdline) output to a text file and you can then read it back in to your app.

    Pseudocode:

    VB Code:
    1. Open "myjavac.bat" for Output as #1
    2. Print #1, "javac " & strMyFileName & " >output.txt" 'name the output file whatever you want
    3. Close #1
    4.  
    5. Shell("myjavac.bat")
    6.  
    7. DoEvents    'Wait for it to finish creating the output file
    8. Open "output.txt" For Input As #2
    9. Input LOF(2) #2, strOutputText
    10. Close #2

    I did pretty much the same thing for a PERL interpreter.
    Bear in mind this is the quick and gritty way to do this, but it (for the most part) works

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