how to compile and run java program in cmd with package code example Example: compile java code with package in cmd javac –d . demo.java