I wanted to run btrace on a short running program from NetBeans so I started jvisualvm from a Window command prompt then started the program in debug mode from NetBeans and set a breakpoint on the first statement in the "main" class.. I then right-clicked the program from the visualvm Applications window and selected "Trace application". Then I selected continue on netbeans to run the program and the output of the btrace was created on visual VM. Is this the easiest way to run a btrace session on a quick program from NetBeans?
Asked
Active
Viewed 311 times
1 Answers
0
Using VisualVM to generate a trace of short running applications does not seem to be optimal. You would be better of with a CLI approach.
- Pre-compile the BTrace script using btracec
- Create a new project configuration in NetBeans and add the following VM options
-javaagent:<path-to-btrace-agent.jar>=stdout=true,script=<path-to-compiled-script>
- Select this configuration and run the application to obtain the tracing output from stdout

JB-
- 2,615
- 18
- 17
-
I received this error when I tried it:Error occurred during initialization of VM agent library failed to init: instrument Error opening zip file or JAR manifest missing : C:\User\scvblwxq\Downloads\btrace-bin\build\btrace-agent.jar, I tried it with the .zip file and received the same message. – scvblwxq Sep 02 '14 at 13:39