Question: Can anyone tell me how I can convert a .java file into .class file with an executable bytecode?

Answer: 
Use the javac program that comes with the JDK (visit java.sun.com if you don't have it). The installer does not automatically add javac to your system path, so you'll need to add the bin directory of the installed path to your system path before you can use it easily.
You can not compile any java file to class directly.
It should have main method to compile it in class file