running an external exe file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: running an external exe file

  1. #1
    Join Date
    Oct 2004
    Posts
    2

    running an external exe file

    i have a file called cplus.exe in the same directory as my java program, what code would i use to call this? i get it to open but the console doesn't open, it only shows it running in the process tab in the task manager.


    could somebody show me the code to run this, where it will open the command prompt box then run the program?

    this is what i have so far, it will load a vb program:

    Code:
    try
                        {
                             Runtime rt = Runtime.getRuntime();
                             Process p = rt.exec("vbex.exe");
                             InputStream in = p.getInputStream();
                             OutputStream out = p.getOutputStream();
                             InputStream err = p.getErrorStream();
    
                            }catch(Exception exc){/*handle exception*/}

  2. #2
    Join Date
    Oct 2004
    Posts
    12
    Process p = Runtime.getRuntime().exec("cmd /K ./cplus.exe");

    run "help cmd" from the console.

    if you're just looking for a way to find the directory which the user put your program, play with this:
    http://javaalmanac.com/egs/java.io/T...ree.html?l=rel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center