I have to write a .sh launching an UI application covered with Jacoco. On exit, a jacoco report must be generated.
I'm not able to generate the jacoco.exec with this simple command :
java -jar ../binaries/editor.debug/application.jar -javaagent:/atgl/products/jacoco/0.6.3/lib/jacocoagent.jar=destfile=jacoco.exec
The problem was the position of the -javaagent option. It needed to be in first position, like this :
java -javaagent:/atgl/products/jacoco/0.6.3/lib/jacocoagent.jar=destfile=jacoco.exec -jar ../binaries/editor.debug/application.jar
Then as Godin said, it's not possible to generate report in command line. I created an ant file exectoreport.xml with a rule do_jacoco_reports. The rule is launched by a script exectoreport.sh, that must be called after the natural exit of the application.