Saturday, June 5, 2010

How to use and install Yourkit, Java Profiler with YourKit

Java Profiling:

In software engineering, program profiling, software profiling or simply profiling, a form of dynamic program analysis, is the investigation of a program's behavior using information gathered as the program executes. The usual purpose of this analysis is to determine which sections of a program to optimize - to increase its overall speed, decrease its memory requirement or sometimes both.

There are many profiler are available in the market for Java. But I use yourkit java profile and going to step by step setup.

How you can profile your java application using yourkit Java profiler.

1. Download yourkit java profiler from here. You can download trial version for 2 weeks and see the website for more information.
2. During installation it will ask path to insatll the yourkit. Give any path but without space like c:\yourkit
3. Create one small project in Eclipse say(JavaTest)
4. Create one simple Java file to check in profiler say (
package com.binod.suman;

* Author @ Binod Suman

public class App
public static void main( String[] args )
System.out.println( "Hello World!" );
App test = new App();

public void check(){
String name="Binod";

public String getName(String s){
System.out.println("YES :: "+s);
for(int i=0;i<10000;i++){
try { Thread.sleep(1000); }
catch (InterruptedException e) { e.printStackTrace(); }
} return s;

5. First start the yourkit. (Start -> All Programs -> Yourkit java profiler -> Yourkit java profiler .
The profiler can automatically detect all locally running profiled applications. If more than one is found, you will be asked to select one. If only one application is found, the profiler will connect to it without prompting you.

6. Now run your now see the YourKit Profiler

It will show one Application runnig (com.binod.suman.App) started without profiler. If you will double click on the application,

YourKit will show one error message that The application cannot be profiled because it has not been started with the profiler.

So, now how you will connect your application with YourKit profiler

1. In Eclispe, right click on the mail java file ( -> Run As -> Run Configurations ... -> Go to Second Tab Argumetns -> Go to VM arguments: and paste
click on Apply then Run.

Next time onward no need to do all these thing, just run it.

Now come to Yourkit profiler this time it will show Started with profiler
Now you can double click on your application (App) and it will show all the CPU, Thread, Memory, Deadloccks, Garbage Collection, Summary details of the your application.


Thanks .......... :)


  1. Hi Binod,
    im anudeep currently working on a project related to apache couchDB using java. I saw ur comment at "dr dobbs" regarding the article "couchDb - java" @ (";jsessionid=FKKSZIDAN1GF3QE1GHOSKHWATMY32JVN?fmid=11111&pgno=2") and u said that its working.
    I've added all the jar files specified by u in the comment but still am unable to perform the CRUD operations on the couchDB. What are the packages that i should import in order for the classes like "Session", "HttpClient", "HttpGet" etc... to make work. I'm using eclipse as platform. The error that i'm getting is "Session cannot be resolved to a type"..
    please help me with the problem. U also said that it worked for you. If u still have that implementation, it will be of great use to me if u provide me with a copy of that. Expecting a reply from you..
    --anudeep ->

  2. Hi I want to profile my android kernel using Java Profiler .Is it possible?If so please give me the steps to do that.

  3. This is really help me, thanks!


You can put your comments here (Either feedback or your Question related to blog)