Understanding Java ClassPath

 Java class path


```

java -cp <path_to_jar>:<path_to_current_class> Main.class -> for linux

java -cp <path_to_jar>:<path_to_current_class> Main.class -> for windows

```

java -cp ..:. Main


.. indicates the previous directory

; | : separator for linux or windows

. indicates the current working directory 


loading classes from jar

to create jar


jar cvf <jar_file_name.jar> class1.class class2.class

java -cp ..:. /path/to/jar:. Main


compiling Java file where dependent classes not in the same directory,


javac -cp <path-to-deps.java>:<path_to-current_class> <className>


via jar

javac -cp <path_to_jar>:<path_to_current_class> <class_name>