I have a main class in 'outer.jar' file. Inside this jar, there is another jar called 'inner.jar' in classes/lib folder. How can I make the inner jar run when I run the outer jar using the command java -jar outer.jar?
My main class is running another jar called 'inner.jar' and consuming the output. Now my application is also packaged as a jar called 'outer.jar' and when I run this 'outer.jar', then the main class is unable to run the inner.jar
outer jar main class code:
public class OuterJarMain{
    public static void main(String[] args) {
            String path = OuterJarMain.class.getProtectionDomain().getCodeSource().getLocation().getPath();
            ProcessBuilder pb = new ProcessBuilder("java", "-jar", path.substring(1)+"lib/inner.jar", "1");
            try {
                Process p = pb.start();
            } catch (IOException e) {
                e.printStackTrace();
            }
The code works fine when the main class is executed from IDE because the inner.jar is available in target/classes/lib folder. But when I run the outer.jar from command line then the path is displayed as /C:/....../outer.jar!/.../classes!/ and the inner.jar is not executed