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.
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.
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
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
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