I’ve been developing a new Scala application named Cato that requires some command-line parameters, and I just had to figure out how to configure Eclipse so my application would get those parameters. Doing this with Scala in Eclipse is different than configuring Java command line parameters in Eclipse, so I thought I’d share the recipe.
Fortunately it’s just a two-step process. First, click the drop-down icon next to the “Run” button and choose “Run Configurations”, as shown here:
Then on the window that comes up next, choose your Scala application in the list on the left, then click the “Arguments” tab, and supply your application’s command-line arguments, as shown in this image:
From that window you can then click “Apply” and “Run”, or “Apply” and “Close”, and then run your application, and your application should pick up the command line args you just gave to Eclipse.
What didn’t work
What I was used to doing with Java applications was pressing [Command][i]
to bring up the Project Properties dialog, and then configuring the Java Run/Debug settings, but this approach does not work with a Scala application. I found that I had to follow the steps I just showed in those two images for this to work properly.