I am working on an extension 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.
When the Scala interpreter is invoked, it refuses to run the code with the following message:
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.
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.
Searching the web, I found a proposal, 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.
Maybe I don't understand fully the proposal. Does anybody know of a solution for this?