Say you’ve got a number of main classes in your SBT project. Issuing a

> run

from SBT in interactive mode will display a menu with options to run one of the many main classes detected:

 [1] net.ssanj.stm.refs.OneOfTwoValuesChangedAfterOneRead
 [2] net.ssanj.stm.tmap.AReadValueHasChangesAndAnotherKeyIsRead
 [3] net.ssanj.stm.tmap.AReadValueHasChangesAndIsReadAgain
 [4] net.ssanj.stm.tmap.AReadValueHasChangesNothingElseIsRead
 [5] net.ssanj.stm.tmap.AValueIsReadAndAnotherValueIsAdded
 [6] net.ssanj.stm.tmap.LostUpdateAdditionalRead
 [7] net.ssanj.stm.tmap.LostUpdateNoAdditionalRead
 [8] net.ssanj.stm.tmap.RetainTest
 [9] net.ssanj.stm.tmap.ThrowsException

You can also do the same from the command line with:

sbt run

What if you needed to run a specific class but with some parameters? You can use:

> runMain package.path.to.main.class param1 param2

or

> run-main package.path.to.main.class param1 param2

in interactive mode.

To run from the command line you can use:

sbt "runMain package.path.to.main.class param1 param2"

or

sbt "run-main package.path.to.main.class param1 param2"

Although the above methods work, they are a bit tedious because you have to copy the full class path to the class you want to run. It would be nice to run a main class directly through menu with the some parameters. Something of the sort:

> run
 [1] net.ssanj.stm.refs.OneOfTwoValuesChangedAfterOneRead
 [2] net.ssanj.stm.tmap.AReadValueHasChangesAndAnotherKeyIsRead
 [3] net.ssanj.stm.tmap.AReadValueHasChangesAndIsReadAgain
 [4] net.ssanj.stm.tmap.AReadValueHasChangesNothingElseIsRead
 [5] net.ssanj.stm.tmap.AValueIsReadAndAnotherValueIsAdded
 [6] net.ssanj.stm.tmap.LostUpdateAdditionalRead
 [7] net.ssanj.stm.tmap.LostUpdateNoAdditionalRead
 [8] net.ssanj.stm.tmap.RetainTest
 [9] net.ssanj.stm.tmap.ThrowsException

> 2 "param1 param2"