Saturday, February 18, 2017

Using a Java Agent with Scala/SBT

Just some notes to myself:

Adding unmanaged dependencies to a build:

Unmanaged dependencies work like this: add jars to lib and they will be placed on the project classpath. lib is a sister directory to src
Dependencies in lib go on all the classpaths (for compile, test, run, and console).


Start SBT with Java Agent JAR file:

An example. SizeOf is a program which uses java.lang.instrument and must be launched as a Java Agent:

java -jar -javaagent:/lib/SizeOf.jar /opt/local/share/sbt/sbt-launch.jar 'run-main org.clulab.reach.ShowSizes'

Ended up using JAMM (

java -jar -javaagent:/Users/hickst/workspaceCLU/clulab/reach/main/lib/jamm-0.3.1.jar /opt/local/share/sbt/sbt-launch.jar 'run-main org.clulab.reach.ShowMemReachable'

No comments: