| Author |
Running a dos file from within Java
|
Simon Haywood
Greenhorn
Joined: Sep 02, 2003
Posts: 6
|
|
Hi, I trying to run a dos .bat file (which try's to ftp a file from my work station to a unix directory) from within my java application which is running on a local intranet from a unix platform. Firstly is this possible.?, as I've tried using runtime exec command, but this seems to be using the unix environment to execute my file, which is not there, but located on my work station instead. Thanks in advance for any help.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
Hi Simon, Welcome to JavaRanch! Runtime.exec() runs an external program on the same machine as the JVM that called Runtime.exec(). In general, if one machine A wants to run a program on another machine B, the only way to do it is for A to send a message to some software on B requesting that the program be run. This "some software on B" can take many forms, depending on the circumstances. Anyway, if you need more info, your explanation is a little hard to follow. Let's say there's a Windows computer A, and a UNIX computer B. Now, tell us, using "A" and "B", what the role of each computer is.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Simon Haywood
Greenhorn
Joined: Sep 02, 2003
Posts: 6
|
|
Originally posted by Ernest Friedman-Hill: Hi Simon, Welcome to JavaRanch! Runtime.exec() runs an external program on the same machine as the JVM that called Runtime.exec(). In general, if one machine A wants to run a program on another machine B, the only way to do it is for A to send a message to some software on B requesting that the program be run. This "some software on B" can take many forms, depending on the circumstances. Anyway, if you need more info, your explanation is a little hard to follow. Let's say there's a Windows computer A, and a UNIX computer B. Now, tell us, using "A" and "B", what the role of each computer is.
|
 |
Simon Haywood
Greenhorn
Joined: Sep 02, 2003
Posts: 6
|
|
Oops, you can tell I'm new at this... The situtation I have based on A being a windows computer (client), and B a unix computer (server) is; The URL entered in the browser on A points to a java application running on B. I then wish to transfer files from A to B, so they can be imported into the application's database at a later stage. If I understand correctly, then this is not possible using Runtime.exec(), as the JVM is machine B. Any other suggestions on how to connect to machine A to get the files to transfer to B...?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
|
You can use HTTP file upload; see, for example, here.
|
 |
 |
|
|
subject: Running a dos file from within Java
|
|
|