The main thing you need to do is set the PATH variable for your user. You can do this by modifying a file in your users directory. The exact file name depends on which shell you use. For example, if you are using bash, then open ~/.bashrc in your favorite text editor and add the following line at the end:
Then the next time you open a terminal, you can just type commands like "javac" and "java" to compile and run your own Java programs.