$ vi ~/.bashrc
Press 'a' on the keyboard to insert... and type in the following:
# User specific aliases and functions
**NOTE: Your path my differ, depending on version and if you have SDK or just JRE. Please go to the /usr/java directory and right down the proper directory name and be sure to add /bin on the end**
Press 'Esc' to stop inserting.
Press ':' to bring up the vi command prompt.
Press 'x' to exit and save.
Now log out of KDE or Gnome and log back in.
$ which java
Should return the path to your java install.