title: Scala as a shell script: jars on the classpath
body: <p>You can run a scala script as a linux shell script:</p>
  
  <pre><code>#!/bin/sh
  exec scala "$0" "$@"
  !#
  
  println("Hello")
  </code></pre>
  
  <p>In one such script I need to load classes from a group of jars (which happen to be in the same directory as the script). If this were the REPL I could use <code>:jar</code>, but that's not available in script mode.</p>
  
  <p>I'm trying to set the <code>-classpath</code> parameter:</p>
  
  <pre><code>#!/bin/sh
  exec scala -classpath '.:./*.jar' "$0" "$@"
  !#
  
  import javax.media.jai.{JAI, RenderedOp}
  </code></pre>
  
  <p>but the compiler just can't find the classes:</p>
  
  <pre><code>error: object media is not a member of package javax
  import javax.media.jai.{JAI, RenderedOp}
               ^
  </code></pre>
  
  <p>How do I include these jars?</p>