Starting a batch file from a running app


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Starting a batch file from a running app

Hybrid View

  1. #1
    AAZ Guest

    Starting a batch file from a running app


    I have a Java server that needs to start another java app on command, to do
    that it must run a batch file on the file system. (Windows.) What command
    do I use to kick that batch file off and do I need to switch directories
    to where it is first so that it will run local to its own directory (like
    in VB)
    Thanks


  2. #2
    Paul Clapham Guest

    Re: Starting a batch file from a running app

    If you want to run another program, the command to use is
    Runtime.getRuntime().exec(); there are half a dozen varieties of this
    command, but in the simplest you just give a string containing the command
    you want to run. If the other program is Java, make sure your DOS path
    includes the location of your JRE, then you won't have to switch directories
    first. In that case your command will look like "Java theClassToRun". If
    you have your classpath already set up, you won't have to specify it in your
    command.

    AAZ <ziehlke@mitem.com> wrote in message news:39788c5a$1@news.devx.com...
    >
    > I have a Java server that needs to start another java app on command, to

    do
    > that it must run a batch file on the file system. (Windows.) What

    command
    > do I use to kick that batch file off and do I need to switch directories
    > to where it is first so that it will run local to its own directory (like
    > in VB)
    > Thanks
    >




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