Setting JAVA_HOME and ANT_HOME on Ubuntu / Linux Mint

This might be helpful for the newbies who are starting their career in software development with  Java lang. And of course its not like in old school when it comes to the industry, we use application build tools for proper deployment of enterprise applications. Such commonly used build tool is ‘ apache – ant ‘. Before starting any big work with java and ant, you have to define ‘Java home’ and ‘Ant home’ to make use of them. Follow the following steps by adding few lines to your ‘.bashrc’ file,

Step 01: Locating .bashrc file.
If your on ubuntu, bashrc can be found on home directory as ‘.bashrc’ . If its Linux Mint go to /etc and open ‘bash.bashrc’ as super user mode to edit via a teminal.

sodu gedit bash.bashrc

sodu gedit bash.bashrc

Step 02: Setting ANT_HOME
Include the following block of text at the bottom of your ‘bash.bashrc’ file (if ubuntu, then .bash).



I have stored my apache-ant folder in ‘/usr/local/’. Change the path according to your apache-ant folder location.

Step 03: Setting JAVA_HOME
Same as you did for ANT_HOME, include the following block of text at the bottom of bash.bashrc file. Include the correct path of java jvm.



You are good to go!

 BTW I’m listening to Pretty Girl (The Way)” by sugarcult. Its really cool 😛


Reinstalling the GRUB

      New Linux users like to keep windows in their computers while getting use to Linux. But I don’t recommend that because when they find something hard in Linux or something new to do in Linux, most of them just forget about everything and get it done in windows. So they won’t learn anything new.

             However most new users think whenever they run a new installation of Windows the GRUB gets disappear so they also have to reinstall Linux. But that’s not the way! Oops, I almost forgot to tell what GRUB is. Well GRUB stands for GRand Unified Bootloader. It’s a flexible and a powerful boot loader which comes with Linux. It’s useful when we use more than one operating system in a single PC.

            So the reason for the disappearance of GRUB is when user installs Windows or any other OS after a Linux installation, the newly installed OS rewrites the MBR (Master Boot Record) with its own boot loader. OK then this is the way to re-establish the GRUB.

       0. Boot the machine from your Live CD/DVD.


1.      Open a terminal/konsole and get into root mode by giving

sudo  su


            2.Then type ‘grub’ and press enter. This allows the user to run the grub shell.


3. Setting the root device. Root device means the partition which contains the ‘/boot’ directory. If you’re not sure with that, you can find the corresponding partition by giving,

grub> find  /boot/grub/stage1

                        I have resulted this,


grub> find  /boot/grub/stage1

grub> find /boot/grub/stage1

            This says my hard disk number is 1 and partition number is 3.

            Note: hard disk numbers and partition numbers are starting from 0.

(According to me, this is the 4th partition of my 2nd hard disk)

                        Now, I’m setting it as the root device.

                        grub>root  (hd1,3)


4.After setting the root device correctly run the following command,

 grub>setup  (hd1)

            This tells to install the GRUB to the MBR of the 2nd hard disk.


            5.Now exit from the grub shell



   The missing GRUB is back on business. 

%d bloggers like this: