The terminal will keep a history of your last run commands. You can use the "up" arrow to navigate through them. You may also use some sort of bash alias/function so you have to type less. I don't know if there are tools to auto type a single command. It's never been an issue for me. Something to do is effectively dedicate a tab of iTerm to performing your building/testing. That way you only need to navigate there once. You can then use the previously mentioned tips to run your program.
When I say "streamline" you may also read "make easier/faster". Let's say your normal workflow is to do the following to test.
- Use mouse to bring iTerm into focus.
- Type the command to compile your program (javac ...)
- Execute your program (java ...)
- Enter input required.
Alternatively, let's say you do the following.
- Hotkey to bring iTerm into focus.
- Use a bash alias/function to build and execute your program. You could also use file redirection for the input.
With the, what I will loosely call an improved workflow, you can do the same tasks in fewer steps. By using a hotkey (though you could always cmd+tab to iTerm), it'll take less time to bring iTerm into focus. By using an alias/function, you can reduce the number of steps to build and execute your program. Rather than going through the history to build and execute separately, there is now a single command. Though this can also be done through chaining using "&&" to build and execute. Finally, redirecting the input just makes things nice. Rather than having to do type in your input, which can be error prone and time consuming, you can be sure the same input is being used each time. This last point moves towards testing process. I don't know what your class covers, but I would think testing would be covered at some point (if you are not familiar with it). If it isn't and you aren't ask your teacher and/or do some independent research.