It's true. This is equivalent to the
java -jar myjar.jar
command. Which takes as its classpath the jar itself, but no embedded jar or class directories. This has often been an annoyance to people who write self-executing jars that use third-party
JDBC drivers.
The quick and ugly solution would be to use a standard classpath:
java -classpath ./myjar.jar:/here/there/myjdbcdriver.jar com.bar.foo.MyMainClass
An alternative is to augment the standard classloader features of the java runtime with classloading code of your own. For example:
java -jar myjar.jar -Dmydbdriver=/here/there/myjdbcdriver.jar
Or something like that (say, getting the database driver location from a config file). To make that work, you'd then write classloading code that went out and got the external classes and loaded them.
It's not that difficult to write augmentations for classloading, but it's not a "fresher" job, either. For simple EJB client
testing, you're better off not attempting to use the app jar as a self-executable jar and provide an explicit classpath. The fancier stuff is for when you want to provide a commercial-grade product that's easier for other people to use.