Hello Charlie,

if you don’t want to write the execution data to a file you can start the agent 
e.g. in tcpclient mode. This is how for example our coverage launcher in 
Eclipse works:

1) Start an TCP server on an arbitrary port
2) Programmatically launch the JVM with the parameter 
-javaagent:pathToJacocoAgent=output=tcspclient,port=<port allocated in step 1>

The agent will connect to the server and send execution data when the JVM shuts 
down or you can also request dumps at arbitrary points in time.

Our example comes with basic execution data server: 
https://www.jacoco.org/jacoco/trunk/doc/api.html

You might also take a look at the implementation for the Eclipse plugin: 
https://github.com/eclipse/eclemma/blob/master/org.eclipse.eclemma.core/src/org/eclipse/eclemma/internal/core/launching/AgentServer.java

Regards,
-marc

> On 4. May 2020, at 15:03, Charlie Gordon <[email protected]> 
> wrote:
> 
> Hello, dear developers.
> 
> I have a .jar file of the compiler that I want to instrument by passing it 
> one program or another. How can I do this programmatically?
> 
> I saw your instrumentation API example "CoreTutorial.java", which 
> instruments, executes and analyzes a single target class. 
> But it remains unclear how to do the part related to instrumentation and 
> obtaining the result, 
> if you need to execute a command like this programmatically, and preferably 
> not writing the result to a file, but immediately passing it to the report 
> generation module:
> 
> java -javaagent:pathToJacocoAgent=destfile=pathToJacocoExec -jar 
> pathToCompiler.jar fileForCompiler
> 
> I would be grateful if you would help with this.
> 
> Thanks for your work.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/933ae953-3fd6-4561-8c33-88915cdff814%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/933ae953-3fd6-4561-8c33-88915cdff814%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/EE44143B-0742-45AE-AA62-06C53928C848%40mountainminds.com.

Reply via email to