When working with shells, if your Mac does not show various colors automatically, you can enable them by two easy steps.
First add a line as shown below to your .bash_profile. This file should be under your home directory.
Second, add the following line in your .vimrc file. This file should be under your home directory. If it is not there, create one.
While Unix/Linux is the most popular OS for hosting enterprise java applications, there are still significant amount of applications deployed on Windows Platform. If your application is running on a Windows box, you ought to know how to get around Windows in order to support your application effectively.
In this piece, I’m going to share with you 10 tricks every Java Developer should know. I tested these in Windows 2008 R2. But it should work on most Windows flavors. Let’s get right to it.
1. Find the full command line of your java application
In Unix/Linux, if you need to see the full command line of your application, you can simply use ‘ps –ef’. For example,
ps –ef | grep <my application>
Alas! There is no ‘ps’ in windows. So, how do you do this? Say hello to Windows Task Manager.
Oracle Hotspot, IBM SDK, HP NonStop Server for Java, Jrockit…. Why so many flavors of JVM? And more importantly, why do you care ?
While it is Sun/Oracle that originally created the Java Virtual Machine, since JVM is basically a set of specifications, any vendor could create their own version of JVM. Several vendors jumped in to create their spin offs. Some are free and open source but some are proprietary. The following JVMs are prominent in the market today
In addition to the above, Apple has their own spin off that is used in MAC.
Sun/Oracle HotSpot is still the market leader (about 60%). Oh, by the way, you will be surprised to know that there are more than 30 JVMs out there. Did you know apache had its own JVM (Apache harmony) ?
Why do you care which JVM is being used?
As an Application Support Engineer, you have to care about the flavor of the JVM for four major reasons
In a JEE Application Server such Oracle WebLogic or IBM WebSphere, where exactly does JVM fit in?
In short, each instance of a JEE Application server runs as a JVM that executes one or more JEE Applications deployed. In other words, Application Server is yet another java application (a big one) that executes custom developed JEE Applications.
Earlier we saw how a JVM can be started by using the ‘java’ command and passing the class name as the parameter
In a JEE Application Server’s case, it will be something like this:
java –classpath /opt/jboss-as/bin/run.jar com.jboss.Main
The above example starts a Jboss Application Server. Note that there will be several additional Java command line parameters in real world.
Let us understand what a JEE Application Server really is.
A Java application is launched with the java command which starts a JVM and runs the application. As an Application support engineer, there are few basic operations that you will typically perform on the JVM. Here are they:
Starting the JVM simply means starting the Java application. A Java application is started using the java command.
java is the command
HelloWorld is the classfile without the .class extension
Note: Don’t use the .class extension in the java command. If you do, you will get an error
[ec2-user@java]$ java HelloWorld.class
Error: Could not find or load main class HelloWorld.class
There are numerous command line options for the java command. Here are some of the main ones you need to know.
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:
- Java is a high level programming language (this is the code). A java program is a text file(s) that is/are human readable.
- Javac is a compiler program that compiles the human readable java code in to machine readable byte code.
- JVM (Java virtual machine) is a process that runs the java byte code. It is an implementation of specification created by Sun/Oracle.
Virtualization is a technique using which you can run multiple Operating Systems (aka Guest) in a physical server (host) by abstracting (or virtualizing) CPU, Memory, Disk and Network resources. The core component of any virtualization solution is Hypervisor – the software that performs the abstraction of bare metal resources.
Here are the primary benefits of using Virtualization:
- Save cost on hardware
- Centrally manage the infrastructure
- Add effective fault tolerance and high availability
- Dynamically update the infrastructure
The diagram below shows virtualization at a high level.
The verdict is in. Virtualization is the future. If you are still running your applications on bare metal, you are missing out on tons of benefits, or even hurting your business. Virtualization is a software tech that lets you run multiple operating systems and applications on a physical server by abstracting the hardware underneath. Among several Virtualization software makers, the following are considered leaders:
Let’s dive in to 5 reasons why you can’t afford NOT to virtualize (not necessarily in any order)
Yes, AppDynamics is awesome for Application monitoring – Java Heap, deep transaction tracing, tons of out-of-the-box framework monitoring (JDBC,WebService etc) and the list goes on. But do you know Appdynamics can be used to effectively monitor Servers too, whether it is virtual or physical? When I say server, I mean the host operating system such as RedHat Enterprise Linux, Windows 2012, Solaris etc. Let me show you how you can do this.
Enter AppDynamics Machine Agent
While Java can be monitored using a Java Agent, a Server can be monitored using a special type of agent called Machine Agent. You will have to have license to run these agents (When you purchase Application agents, typically AppDyanmics throws the same number of Machine Agents, and so you should be good in terms of additional cost). If you are not sure about your present licensing situation, click on ‘licensing’ in your Controller UI as shown below.
Unlike Application agents which run inside the JVM/CLR, Machine agent is a standalone Java program that runs on the host operating system. It collects hardware metrics and sends them to Controller (once a minute). A user can view these metrics via Controller UI. Pretty simple, hah?