-1

I have executed some Linux commands using Java platform,

Now I want to store those commands description into a file.

How to do this using java?

parvezalam khan
  • 480
  • 2
  • 11

1 Answers1

0

If you're running your Java program from the shell, you can redirect it's output to a file using the '>' operator.

EXAMPLE# java MyProgram.class > output.txt

  • OS is Linux, But i am running program in eclipse using Java.I have executed all linux commands individually in eclipse console. Now i want to transfer that console output to file.txt. – keerthi tn Apr 21 '17 at 10:32
  • It's been answered here: http://stackoverflow.com/questions/5714053/how-can-we-redirect-a-java-program-console-output-to-multiple-files – nfproductions Apr 21 '17 at 10:37
  • I know that procedure but i need from code perspective. If i do run configuration,it is limited to my system only. I want to make code generic, please help me – keerthi tn Apr 21 '17 at 11:06