java compile and run program help

What is the trick to get a java program to run and compile? I can't even get a basic skeleton to run and compile. What packages do I need? I figured the java-gcj and gcc-java packages was enough. Do I need any other packages?

I thought I had to do this and it would work but its not.

javac square.java 
java square

---------- Post updated 10-07-12 at 12:51 AM ---------- Previous update was 10-06-12 at 11:33 PM ----------

I forgot to say in Fedora.

Well, if you have javac usually that means you have a JDK not a JRE. I usually use eclipse any more, or jar the class files before execuing. Perhaps $PWD or . is not in the $CLASSPATH ?