-
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
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks