jy95
jy95

Reputation: 783

JaCoCo 0.8.4 - Error: Could not find or load main class –javaagent:jacocoagent.jar

I would like to use JaCoCo in command line so I tried :

java –javaagent:jacocoagent.jar -jar task_evaluation.jar

in my project structure :

   task_evaluation.jar
   jacocoagent.jar

But I get this error message :

Could not find or load main class –javaagent:jacocoagent.jar

My Jar is correctly build ( it works as expected without the javaagent ) so the error doesn't come from here.

enter image description here

My MANIFEST.MF :

Manifest-Version: 1.0
Class-Path: . /libs/junit-4.12.jar /libs/hamcrest-core-1.3.jar
Created-By: 1.8.0_201 (Oracle Corporation)
Main-Class: src.StudentTestRunner

I donwload the jar file from https://www.jacoco.org/jacoco/index.html (and copied the lib/jacocoagent.jar , lib/jacococli.jar )

Any ideas ?

Upvotes: 1

Views: 1529

Answers (1)

jy95
jy95

Reputation: 783

The problem was in the command itself - we must use -, not

java -javaagent:jacocoagent.jar -jar task_evaluation.jar

Upvotes: 2

Related Questions