install apache benchmarking tool – ‘ab’

On WINDOWS machine :

Download httpd-****-x86 from

After going through the installation process –> Go to the directory where its installed

similar to C:\httpd-2.4.12-x86\Apache24\bin in my case, add this to system ENV Variable


On UNIX machine :

did not work –>> sudo yum install httpd-tools

Below long procedure worked, and it also needed to switch to root user and running it, running command with sudo did not work

You will need to install apr-utils and yum-utils first.

yum -y install apr-util
yum -y install yum-utils


extract Apache Benchmark from httpd-tools. And here is how.

mkdir ~/httpd-tools

cd ~/httpd-tools

yumdownloader httpd-tools


Now extract ab (Apache Benchmark) and move it to  /usr/bin  folder

rpm2cpio httpd-tools-2.2.24-1.29.amzn1.x86_64.rpm | cpio -idmv

mv usr/bin/ab /usr/bin/ab

cd ~

rm -rf ~/httpd-tools



sample command to test with –

ab -ki -n 500000 -c 200

-n    specifies the number of requests,

-c    number of concurrent connections,

-k    stands for HTTP Keep-Alive,  

-t    maximum time of awaiting for response from connection


Setup up ssh to login without entering password

Considering situation where we need to connect from Server A to Server B

  • On Server A, run the below command to generate the public key

    ssh-keygen -t rsa

    Note: If you don’t have ssh-keygen command recognized in your system, install Git – which will provide required file for running ssh-keygen command.

    After installing Git, add this/similar path to your system environment variable C:\Program Files (x86)\Git\bin\ssh-keygen.exe

    This command should generate file in your <homedir>/.ssh/ directory

  • On Server B

    create a folder in the <homedir> with name .ssh

    Copy the file from Server A, into this .ssh directory.

    Append the contents of file to authorized_keys file inside the .ssh directory on Server B.  If one authorized_keys file does not exist – create it.

That’s it! now we should be able to login without having to enter password every single time.

Loading file from specific path

         Context context = null;
         try {
                File configFile = new File(“<provide absolute path to your file>“);
                Properties prop = new Properties();
                FileInputStream istream = new FileInputStream(configFile);
                context = new InitialContext(prop);
            } catch (NamingException e1) {
                // TODO Auto-generated catch block
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
            } catch (IOException e) {
                // TODO Auto-generated catch block

Java Single Jar file with multiple main method classes

* Sample launcher
public class Launcher {

    public static void main(String[] args) throws Exception {
        if (args != null && args.length > 0) {
            String option = args[0];
            String[] args2 = new String[0];

            if (args.length > 1) {
                args2 = new String[args.length – 1];
                System.arraycopy(args, 1, args2, 0, args2.length);

            if (option.equals(“JbossJavaTCPSender”))
                new JbossJavaTCPSender().exec(args2);
            else if (option.equals(“JbossJavaTCPReceiver”))
                new JbossJavaTCPReceiver().exec(args2);
                System.out.println(“Connot find such class to execute having name [“
                        + option+”]”);
        } else
            System.out.println(“Usage : Provide ClassName as an argument to execute.”);
            System.out.println(“\t[java -jar JbossJavaTCPExample.jar JbossJavaTCPSender]”);
            System.out.println(“\t[java -jar JbossJavaTCPExample.jar JbossJavaTCPReceiver]”);

java specifying jar file while running program from command line


Spent one whole day to figure out semicolon(;) in windows is equivalent to specifying colon(:) on unix platform.

If all of the jars are placed into a folder called ‘jars’ in the current directory.

on Windows –> java -cp .;jars/* AbsoluteClassname arguments

Unix –> java -cp .:jars/* AbsoluteClassname arguments



Exception in thread “main” java.lang.NoClassDefFoundError: