title: How to set up classpath for the Scala interpreter in a managed environment?
body: <p>I am working on an <a href="https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/console-parent" rel="noreferrer">extension</a> for the Apache Wicket web framework, which lets the user execute code in several programming languages at runtime from the browser. One of these languages is Scala, but I am having trouble when it is bundled as a WAR file and deployed to a container such as Tomcat.</p>
  <p>When the Scala interpreter is invoked, it refuses to run the code with the following message:</p>
  <pre><code>Failed to initialize compiler: object scala not found.
  ** Note that as of 2.8 scala does not assume use of the java classpath.
  ** For the old behavior pass -usejavacp to scala, or if using a Settings
  ** object programatically, settings.usejavacp.value = true.
  </code></pre>
  <p>After setting up usejavacp on the Scala settings, it still didn't work in a managed environment. The problem seems to be that the Scala interpreter cannot find the Scala library jars on the Java class path.</p>
  <p>Searching the web, I found a <a href="https://gist.github.com/404272" rel="noreferrer">proposal</a>, which proposes the use of two classpath resouces named 'boot.class.path' and 'app.class.path', which should include the needed classpath declarations. I tried this and it seemed to work. My problem with this solution, though, is that my extension is meant to get bundled into a WAR file and to be run in different environments, so it would be necessary for the user to modifiy these resources with respect to the environment it runs in. Also it would be a lot of work to include every single jar's path into the file.</p>
  <p>Maybe I don't understand fully the proposal. Does anybody know of a solution for this?</p>