Just summarize everything to the smallest detail,
when someone does
java filename.java
He / she actually runs the Java compiler and converts the code into instructions that the JVM understands.
Now that one is running
javac main_file
he / she calls the JVM to run the entire project, whose main method is in the main_file class
This main_file is actually a fully qualified class name, i.e. if I have a ProjectX project and this main class is in the src.java.hello.main package,
You must run the command
java src.java.hello.main.main_file
Hence it . is actually a reserved thing at the end of the JVM, and we cannot provide .class as part of the java command argument.
swayamraina
source share