Whether or not an alias is enough will depend a lot on the program in question and how you use it. If you are the only user on your machine using the program, and you always call it from an interactive console, and never use it inside scripts, then an alias might be sufficient (unless you notice things not working right).
But if you want to use the command in scripts, or even put launchers to it (in the GNOME menu or gnome-panel or in a dock, etc.), then it'll be more convenient to do something else.
Your other options are to 1) define a symbolic link, from, e.g.,
sudo ln -s /usr/java/jdk1.6.0_21/bin/javac javac
javac helloworld.java should work.
Or 2), modify your $PATH environmental variable to include the directory in question, e.g., in your .bashrc or .profile, etc., put:
And then all the executables in that folder can be called directly.