Use javac to compile a Java program. Command
javac prog.javaconverts the Java program in file prog.java into another file, prog.class, that the Java interpreter can run.
The Java interpreter is called java. It runs a compiled Java program. Command
java progDo not write .java after the program name.
If your program goes into an infinite loop, you will need to stop it. Type control-C. That will usually stop it.
If for some reason control-C does not work, there are more involved ways to stop it. You might need to start another terminal. Command
ps ushows all processes that you are currently running. Find the one that is your program. It has a process number. If n is the process number, then command
kill nwill usually stop it. If it doesn't, then
kill -9 nwill always stop it.