title: How do I run an sbt main class from the shell as normal command-line program?
body: <p>How can I run an sbt app from the shell, so that I can run my app as a normal command-line program (as if run directly via <code>scala</code> but without having to set up an enormous classpath)?</p>
  
  <p>I know I can do:</p>
  
  <pre><code>echo hello | sbt 'run-main com.foo.MyMain3 arg1 arg2' &gt; out.txt
  </code></pre>
  
  <p>But this (1) takes forever to start because it starts sbt, (2) causes all stdout and stderr to go to stdout, and (3) causes all output to be decorated with a logger [info] or [error].</p>
  
  <p>I looked at <a href="https://github.com/harrah/xsbt/wiki/Launcher">https://github.com/harrah/xsbt/wiki/Launcher</a> but it seems too heavyweight, since it downloads dependencies and sets up a new environment and whatnot. I just want to run this app within my existing development environment.</p>
  
  <p>Thus far I've cobbled together my own script to build up a classpath, and you can also do some other things like <a href="https://groups.google.com/forum/#!topic/simple-build-tool/0rhVRPnjyZU">modify your project file to get sbt to print the raw classpath</a>, but I feel like there must be a better way.</p>