first change the dir to the location of saved .java file using the cd on your terminal application or command prompt.
then type javac "asdf.java" whatever, then type java "asdf" and it will run