Cover the remaining code paths for Java apps to define class path

Refs #4926