View RSS Feed

My Java Tips

  1. Java performance Issues

    by , 11-16-2011 at 07:17 PM (My Java Tips)
    In this post, I will talk about Java performance Issues briefly.


    The output of a Java compiler is a bytecode and not an executable code. The Java Virtual Machine (JVM) interprets the Java bytecode at runtime. Most of the modern programming languages such as C, C++ are not interpreted and compiled to the executable code because of the performance concern. When a program is interpreted, it generally executes slowly when compared with an executable code.
  2. Incorporating native code (C/C++)

    by , 11-12-2011 at 05:42 PM (My Java Tips)
    JNI (Java Native Interface) is a powerful feature that provides the developers to call legacy code written in C/C++ and Java. In the post, I will briefly introduce how JNI helps us in doing so.

    First step is to create a Java class that declares native method. Native method’s signature contains keyword native and it indicates that this method is implemented in another language. Native method declaration is terminated with a semicolon. Also note that native method does not contain implementation. ...
    Java SE
  3. Tracking Class Loading and Garbage Collection

    by , 11-08-2011 at 06:41 PM (My Java Tips)
    When any Java program runs, In background some libraries are loaded by JVM (Java Virtual Machine) in order to execute the Java program. Java command line tool(”java”) has various options that might be helpful for a Java programmer to know more about the class loading mechanisms.

    For example “ –cp “ option that instructs JVM to find necessary classes other than system classes. An usage is shown below

    java -cp ExampleDir.ExampleTipIf ExampleTip.class is not found in ExampleDir ...
    Tags: command line, jvm Add / Edit Tags
    Java SE
  4. Memory Leaks

    by , 05-25-2011 at 10:04 AM (My Java Tips)
    You are aware of the fact that garbage collection collects and removes all the unwanted objects from memory without used intervention. But sometimes, you run into memory leaks problems that demands investigation. I will shed some light on this issue in the next few posts.

    The Java GC process is a low-priority thread and it constantly searches memory for unreachable objects that are not reachable by any live thread. Different JVMs use different algorithms to determine how to collect ...
  5. Javap

    by , 05-24-2011 at 01:58 PM (My Java Tips)
    Javap is shiped with JDK and it really very useful when you want to see what your compiler is doing to your code. It generates source code from a compiled class file.

    Javap is a utility provided in Java Development Kit (JDK) that can be used to improve source code. this is done by generating source code from compiled code and seeing how our code was treated by the Compiler. Later code improvements can be made.

    A very interesting example can be to see how source code ...