I have some code on a Windows Machine placed in the following directories.
javac -cp .:../lib/* runfile.java
If your project gets more complex I'd recommend using a proper build tool like (in best-to-worst order) Gradle, Ant or Maven.
javac -sourcepath . -cp ../lib/* runfile.java
should work for compilation I think and yes, you need to set the classpath for runtime also like
java -cp .;../lib/* runfile