How to execute shell commands using Java?

December 10, 2010 Leave a comment

Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The current runtime can be obtained from the getRuntime method.

An application cannot create its own instance of this class.

import java.util.*;
try {
Runtime rt=new getRunTime(); //This will create an instance of the current system run time.
Process proc=rt.exec(""); //This will execute the desired command.
proc.waitFor();//will wait for the process to end.
catch(Exception e) {

Now u can execute the shell commands using java…
Automate the testing code with java…

Categories: Uncategorized Tags:

Linux file system explained for beginners

For those of you coming from windows backgrounds, the way the linux filesystem is laid out may seem confusing at first glance…. but that is where this article comes in !

The first thing you should know when working with linux, is that everything is treated as either a file or directory. Yeap thats right, even hardware is considered a file by linux, and, speaking of hardware… all your hardware devices are located in the /dev directory, but more on that later.

Another thing that confuses windows users, is the fact that linux dosen’t use drive letters to distinguish between different partitions and devices. that is to say in linux, the “root” of your filesystem is / whereas in windows it would most probably be C:\ . Drives in linux are “mounted” to directories where their data can then be accessed, so for instance, if you needed to use your thumbdrive, you would plug it into your computer, and then mount it using the “mount” command, which specifies the path to the device ( something like /dev/sdb or /dev/sdc ) and the directory to mount it to (usually /mnt or /media), then you can happily access your drive from the /mnt or /media folder.

Sounds strange right? well yes it does if you come from a windows environment, where the entire operating system is consolidated onto a single drive. However, with linux and the ability to mount devices as directories, it gives the end user much greater flexibility in splitting up their operating system over several drives or partitions.

to understand what I mean when I say that this approach in mounting drives grants flexibility, I must first explain the different folders in linux and what they store
Diagram showing Linux filesystem hierarchy

Diagram showing Linux filesystem hierarchy

The graphic above shows the linux file-system hierarchy, now will explain in a bit more detail what each folder contains.

/ this is the root folder, all other folders come under root.. think of it as C:\ in a Windows context.

/bin this folder contains all the user-essential binaries (programs) that are needed to administer and run your linux system… delete this folder and your system is broken.

/boot as the name suggests, this folder contains configuration files and other necessary files that are needed by the bootloader

/dev this folder contains device files (remember, these files represent physical devices, so be careful when working with them)

/etc this folder contains all the configuration files used by the system, you can also start and stop services (daemons ) from here

/home this folder contains the home folders of all the normal (non – root ) users on the system .. think of it as my documents in windows

/lib this folder contains software libraries

/media this is a mount point for removable devices… this is where you would usually mount your thumbdrives … etc

/mnt this is a temporary mount point

/opt this folder contains add on software (extra software)

/sbin this folder contains binaries that can only be run as the root user (”superuser”)

/tmp this folder contains temporary files that are erased upon reboot

/usr this folder and its sub-folders contains user installed programs and utilities and libraries

/var this folder contains files that change alot (”Variable files”)

/root this folder contains the root user’s files

/proc this is a pseudo folder, that contains information about the linux kernel and hardware that is updated in realtime.

Now back to how mounting grants flexibility…

you see how the different folders all contain parts of the operating system? well we can actually mount a seperate hard drive for each of this folders. for example, your /home folder can be put on another harddrive than your / which means that you can easily recover your personal files if the harddrive on / fails because the harddrive mounted to your /home folder is seperate from the one that is mounted to your /

So there you have it, you now know a little bit more about the nuts and bolts of linux based operating systems.

Categories: tutorial, ubuntu Tags: ,

தமிழ் குறிப்பேடு

in gtalk

in gtalk



வணக்கம் இது என்னுடைய முதல் தமிழ் குறிப்பேடு.
நீங்களும் இது போல குறிப்பேடுகளை எழுதலாம்.

இந்த வசதியை ஒரு Firefox addon மூலம் பெறலாம்.

மேலே குறிப்பிட்டுள்ள addon-ஐ இன்ஸ்டால் செய்து, நீங்களும் என்னை போல் தமிழில் எழுதுங்கள்.

குறிப்பு: இதற்கு தமிழ் டைபிங் தெரிந்திருக்க வேண்டிய அவசியம் இல்லை. (எ.க.) வணக்கம் என்று டைப் செய்ய, vanakkam எண்டு டைப் செய்தால் போதும்.

Categories: tutorial, ubuntu Tags: ,




This is a magic. Try it.

If you find the trick just mention it in comments.

Categories: Fun Tags:

Do you need UBUNTU Certification ?

Ubuntu Offers courses as the following,


The Ubuntu Certified Professional (UCP) is a training certification based on the LPI level 1 certification.


This hands-on course will provide participants with the skills they need to deploy, configure and maintain secure Ubuntu Server Edition within the enterprise infrastructure. The course is based on Ubuntu 8.04 LTS and will help system administrators to implement services at an advanced level.


This course is based on Ubuntu 8.04 LTS and aims to train new users of Ubuntu on how to use key applications including mainstream office applications, Internet connectivity and browsing, graphic art tools, multi-media and music.

Now using and learning UBUNTU is got a recognition in the form of a certification.

For further details just use the following link,

Categories: ubuntu Tags:

How to Execute a Bin file in Ubuntu

$chmod +x *.bin && ./*.bin

  • This is the command used to execute a “.bin” file in a UBUNTU OS.
  • This command is the mixture of two commands.
  • First part “chmod +x *.bin” is the command to give global permission to all users for the file.
  • Second part “./*.bin” is the command to execute the “.bin” file.
  • You can replace the * with the file name of your “.bin” file.
  • If it not work just prepend “sudo ” with the command.
i.e.,  $sudo chmod +x *.bin && ./*.bin
Categories: tutorial, ubuntu Tags: ,

Protected: Dual monitors

July 25, 2009 Enter your password to view comments.

This content is password protected. To view it please enter your password below:

Categories: Uncategorized