Steps to compile a java program
Create your
.java
source fileName of the file should be same as class name (just a norm, works otherwise).
Compile your
.java
source file to generate a.class
file.class
file will have same name as class.javac
here is java compiler.
Go to destination folder which contains
.class
file and run following command.Actually filename will be f
ilename.class
but we write without.class
java
here is application launcher
Note that
jvm
looks forpublic static void main(String[] variable)
and not the compiler.Hence, when you do not mention this main function and compile program, it does not give you compile-time error. But when you run it without main run-time error is obtained.
Last updated