I'm thinking of installing linux in my pc as I've heard about the advantages of programming in linux than in windows.
Can you suggest me which version of linux is better for java coding and also the steps to install it.
There are many different Linux distributions. I'd go for one of the most popular, user-friendly ones, for example Ubuntu or Linux Mint, or Fedora Linux.
How exactly to install Java is different for different Linux distributions. First try it out, get used to it (Linux is not Windows, you'll need some time to get used to it!). Then search for specific instructions for how to install Java on your Linux version of choice.
For Java programming, I don't find that Linux has special advantages above Windows or Mac OS X. Java runs well on all of those operating systems.
I consider that Linux affords a better programming environment in general than Windows. But that is because Linux comes with an ocean liner's load of text utilities, databases, servers, development support programs and free compilers and interpreters. Stuff that you'd have to either shell out money for or go haring off all over the place to find and install under Windows can be installed with a single command in most Linux distros. Plus, if you need to create VM's, Linux has no licensing issues. The thousandth VM costs no more than the first one and there are no per-server license documents to have to keep track of.
For Java development, there's less of an advantage. Eclipse runs about equally well under Windows or Linux, JVMs are freely available for both, and almost all servers are likewise available under both OS's. As are most popular IDEs, including the commercial ones.
I'll confess that Linux is my preferred operating system for production because being a Windows security administrator is a full-time job where failure is almost guaranteed, but for development work that doesn't matter as much. I spent several years happily developing stuff on Windows XP systems that ran under Solaris in production.
To the main question, however: I always recommend considering whatever Linux distro is popular in your town. All of the "name" distros are capable, but that way you'll have someone local to help you out with OS-related issues.
An IDE is no substitute for an Intelligent Developer.
Many flavours can be downloaded as a “live CD” or similar. You can run it from the CD for as long as you like, and try it out, before installing anything.
If you do install Linux, I suggest you partition your hard disc as shown here, or even add another small partition mounted as /var. Then you can keep all your work in the /home partition and it will not be deleted if you reinstall Linux correctly.