Aladdin - Scala Bugtracking
[#904] project: distribution priority: low category: missing feature
submitter assigned to status date submitted
Nikolay Gilles won't fix 2007-01-19 10:52:33.0
subject [contrib #293] bin/scala command line not friendly to javaagent
code
Specifying a "-javaagent:<path>" is difficult with the bin/scala, but really the CLASSPATH handling causes a big problem.

This is what I was doing:
export JAVACMD="java -javaagent:lib/aspectjweaver.jar"

scala -classpath bin/example.jar:lib/aspectjrt.jar:lib/dash-obtain-0.9.1.jar:lib/weaveroptions example.ExampleApp
what happened
The java.class.path doesn't include the lib/aspectjrt.jar file (that is instead placed into env.classpath)

The aspectjweaver.jar javaagent handling (for load-time-weaving of AspectJ Aspects) relies on the aspectjrt.jar \
classes to be present.

End result: NoClassDefFoundException
what expected More granular command-line options for bin/scala. I would like to see: * -Xclasspath (to really add things to the java.class.path) * -Xbootclasspath/a (to append to the bootclasspath) * -Xbootclasspath/p (to prepend to the bootclasspath) * -javaopts to set arbitrary options right after the JAVACMD
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-01-19 10:52:57.0
contribution #293
Lex  edited on  2007-01-19 12:17:38.0
Gilles  edited on  2007-05-10 15:47:33.0
The “scala” script deals with most cases. But for complex ones, “java” should be used directly.
Lex  edited on  2007-05-14 11:02:03.0

As Gilles writes, you can use the java command directly if you want precise control over the flags sent to the JVM. You mainly need to ensure that scala-library.jar is available on the classpath; everything else is up to you.

That said, JAVACMD should work, as should the more recent JAVA_OPTS. So you can use things like JAVA_OPTS="-classpath blah -Xbootclasspath/a blarg -enableassertions". If you find that this is not so, then please reopen the bug.