Hi Guys,
My project is divided to a few modules each has its own gradle build file and compiled to a jar lib.
The main module is a Swing desktop application which when needed, forks a child process which is running the JME graphics.
Here is the code for running the child process using ProcessBuilder class:
List<String> command = new ArrayList<>();
command.add("java");
command.add("-XX:MaxDirectMemorySize=1024m");
command.add("-jar");
command.add(launcherName);
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(command);
Process process = processBuilder.start();
StreamGobbler sg = new StreamGobbler(process.getInputStream(),System.out::println);
Executors.newSingleThreadExecutor().submit(sg);
exitCode = process.waitFor();
System.out.printf("Program ended with exitCode %d", exitCode);
The problem with this approach is that the child process is not attached to the debugger (I’m using InteliJ) so I can’t use breakpoints etc. and it slows down my work.
What are you doing for debugging a child process in Java?
Thanks and happy new year!