Check out example codes for "cmd java compile". It will help you in understanding the concepts better.

Code Example 1

javac MyFisrtProgam.java // enter to compile 
  java MyfirstProgram // run program

Code Example 2

// Assuming that you have an executable jar
java -jar myJavaProject.jar

// Assuming that you have packaged jar
java -jar target/myJavaProject.jar

Learn ReactJs, React Native from akashmittal.com