问题
Sometimes, the console in Eclipse just isn't enough, or my program has to be run in a terminal of some sort. How would I achieve this?
I'm using Eclipse Mars 4.5.0 on a MacBook.
Edit: I know how to run Java programs from a terminal, but what I want is Eclipse to do this automatically when I press the run button.
回答1:
Making Eclipse do it for you isn't possible
To do it manually:
First, go to the directory with your *.java file. To go to the directory, use the cd command. Then, run javac yourfile.java. Lastly, java yourfile
来源:https://stackoverflow.com/questions/34140373/how-to-make-eclipse-run-my-program-in-a-terminal