0

Is there some way to pass system commands along with command line arguments in Eclipse?
E.g passing out.txt > passout.txt to the command line arg result in the code to process the out.txt file and rest > passout.txt passed to the terminal for creation.

3 Answers 3

1

I'm not sure about a general answer, but if you want to forward stdout somewhere you can use an option already present in Run Configuration dialog: alt text

Sign up to request clarification or add additional context in comments.

2 Comments

Many thanks, that helps for now... but running my source from bash give me that capability/flexibility in using the sys commands and wondering if it is possible from Eclipse
As explained in my answer, you can use an external tool configuration to start a shell, and give the whole command line as an argument. This way you can invoke system commands, too. I did this once to start a Maven build from within Eclipse.
0

If you only want to redirect the output, the launch configuration dialogs allow this in their last tab, "common", as noted in Jacks answer.

If you want to use input redirection or pipes, you can only use the external tools launcher. Create an external tool configuration and pass the whole command line as one string to the command interpreter, cmd.exe, and pass /c as the first argument. The special syntax of the location tells Eclipse to search the PATH for the program.

Location: ${system_path:cmd.exe}

Arguments: /c echo Hello world>output.txt

1 Comment

My usage of cmd.exe is Windows centric, of course this also works on Linux systems, where you would invoke bash in the same way, possible with other arguments.
0

Right click on Eclipse then go to "Run as" Select Run Configurations Then Select Arguments in new Window First window

Second main Window://i.sstatic.net/MqU2f.png

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.