• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running a dos file from within Java

 
Simon Haywood
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use HTTP file upload; see, for example, here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic