I'm executing 3rd part JAR file, but need to add extra directory to Java classpath, so that the Java application I'm executing is able to find and load my own class.
It doesn't work when I do like the following
java -cp 'path/to/my/class' -jar /usr/local/Cellar/ThirdParty.jar custom-command MyClass -some-more-args
But works with the following
java -cp '/usr/local/Cellar/ThirdParty.jar:path/to/my/class' xxx.company.ThirdPartyMainClass custom-command MyClass -some-more-args
Is it so that when using -jar option class path are ignored? Or what's the difference?