There are some environment variables to be set first.
Have a look at what cubed says here
and do this for the JDK and JRE packages.
You must logout from your account and log back in (for the .bash_profile to rerun.
The simplest way to test if java is running is:
PS. I really recommend Emacs in Java mode. It's a great IDE and won't hog memory like Suns Forte.