Say I have foo.jar in directory x and far.jar in directory y. Both x and y are in directory z.
How can I use javac -cp to include foo.jar and far.jar without specifying every single directory?
It's platform specific.
See here for an example for specifying the classpath for the 'java' command:
https://stackoverflow.com/a/219801/7264777
It should be the same for javac.
Unfortunately you will still need to specify each directory, there is no recursive argument to add all jars in subdirectories.
It would be possible to generate the javac command itself with clever usage of bash find for example.