• Post Reply Bookmark Topic Watch Topic
  • New Topic

Executing Run time execution  RSS feed

 
karthick sambanghi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dears,

I am trying to execute the below piece of code in my program but getting an exception(invalid parameter was specified -- <). But i am able to execute this command in my command prompt. This command is used to load the data for Tera data Database. Kindly give your valuable suggestion.



I have browsed and checked the issue is due to the operators < & > in run time execution. Is there any other possibilities of executing it?..

Thanks in Advance.

Regards
Karthick
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing you should do is to read, and then to implement *all* the advice given in this article. That includes, but is not limited to, using Runtime.exec(String[]) instead of Runtime.exec(String).
 
Paul Clapham
Sheriff
Posts: 22827
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might also consider using a ProcessBuilder instead of a Runtime. It has built-in features to manage the controlled process's standard input and output, instead of what you did there.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot use "<" and ">" to redirect input and output when you execute a program using Runtime.exec().

Note that things like "<" and ">" are special syntax constructs from the Windows command prompt (or a Unix shell, if you're running it on a Unix-like operating system). When you use Runtime.exec(), you are not using the Windows command prompt to run the program; you are telling Windows directly to run the program. Because the Windows command prompt is not involved, "<" and ">" do not have the meaning that you expect when you run something from the command prompt.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!