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

Code Example 1

# cd into the directory that contains your project
jar cvfe <output jar filename>.jar <main class location> *

Code Example 2

jar cvf jar_name.jar class_you_want_in_jar.class

Code Example 3

jar cvf example.jar *

Learn ReactJs, React Native from akashmittal.com