I think it would be better if you specify the JAVA_HOME env variable in your .bash_profile file. If you have root access, you can set it into file /etc/bashrc so that it will be available to all users.
In Unix/Linux, environment variables aren't something you set globally and they apply everywhere. Most commonly you set them in one of the profile files (I prefer .bash_profile) for the account that will use them.
Also, in case you haven't been bitten yet, every time you open a new command shell and don't specify otherwise, you'll get a new environment. A lot of people get frustrated becuase they write a script that sets JAVA_HOME but after they call it, JAVA_HOME's not set, because they didn't export the value from the script's environment to the script invoker's environment.
JAVA_HOME isn't used by Java itself, but it's a very useful convention adopted by all the major Java applications. It makes it possible for different apps to run with different Java versions in the same machine.
An IDE is no substitute for an Intelligent Developer.