≡ Menu

JVM: Basic Framework

  •  
  •  
  •  

As an Application Support Engineer, you will invariably end up managing Java based applications. JVM (Java Virtual Machine) is the all-important process that runs the Java Application you are going to manage (which can be either custom developed by your development group, or a commercial off the shelf product). It is imperative that you have a very good understanding of how JVM works.

Note: Some of the material in this section will be very basic that experienced Administrators can choose to skip.

At a high level:

  1. Java is a high level programming language (this is the code). A java program is a text file(s) that is/are human readable.
  2. Javac is a compiler program that compiles the human readable java code in to machine readable byte code.
  3. JVM (Java virtual machine) is a process that runs the java byte code. It is an implementation of specification created by Sun/Oracle.

For example, consider a simple java program

 [ec2-user@java]$ cat HelloWorld.java

/* Test Java Program */

public class HelloWorld {

public static void main(String[] args) throws InterruptedException {

System.out.println("Hello World !!");

System.out.println("Sleeping for 2 minutes...");

Thread.sleep(120000);

}

}

As you can see, this is a human readable file, with the file name extension .java. Let us not get in to the details of the java code itself (not the scope of this document). The program, when run will print “Hello World !!” and sleep for 2 minutes.

To run the program, you must first compile it using javac command, which will produce the machine readable class file (with the name HelloWorld.class).

[ec2-user@java]$ javac HelloWorld.java

The command silently creates the class file (i.e does not output anything unless there is an error with the compilation)

[ec2-user@java]$ ls

HelloWorld.class HelloWorld.java

[ec2-user@java]$ file HelloWorld.class

HelloWorld.class: compiled Java class data, version 52.0

Now, to run the program, we must use the java command and pass the class file as the argument (without the .class extension)

[ec2-user@java]$ java HelloWorld

Hello World !!

Sleeping for 2 minutes...

Voila! You just cranked up a JVM and ran your java program. Using ps command, you can check for the running program as follows.

[ec2-user@java]$ ps -ef | grep Hello | grep -v grep

ec2-user 2616 2546 0 01:13 pts/2 00:00:00 java HelloWorld

The java command started a JVM instance to run the HelloWorld program.

So, one of your jobs as an Application support engineer is to make sure the JVM runs as efficiently as possible. Your major tasks will include the following:

  1. Ensure JVM is running
  2. Troubleshoot JVM startup issues
  3. Troubleshoot runtime exceptions thrown from the JVM
  4. Troubleshoot JVM Performance issues
  5. Tune JVM to run at its peak performance
  6. Setup Monitoring

A major task that is not included in the list above is Application Deployment as this task requires its own course. In this course, we will focus on tasks pertaining to JVM itself.


  •  
  •  
  •  

Comments on this entry are closed.

Next post:

Previous post: