This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

is Runtime the right class for me?  RSS feed

 
Dave Jones
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I am writing a program that among other things, it copies and recieves files from remote computer, since I've failed to use the Jcraft, I am now resolved to use the Runtime class that (as I understand) I can use to write command lines to the shell , and with this , I can transfer the files I want(as I do through the shell - manually)
does anyone have a simple code sample for writing to the shell ?
or refference? or anything ?
thanks, dave
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the various versions of Runtime.exec(). Basically, you give it either a single String forming your entire command or a String[] of the command with parameters, depending on your needs. You can also specify extra environment variables plus a current working directory.Check out the Process class to see how to capture its output and feed it input.
 
Dave Jones
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, I need some more info,but it seems to be what I'm looking for
Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!