title: Spring Boot start Zookeeper and Kafka Server from Java
body: <p>Until now I've started zookeeper and kafka server from command line before running my Spring Boot application, but now I need to start them directly from code.<br>
  First thing is, I've tried using ProcessBuilder inside main method:</p>
  
  <pre><code>Process process = new ProcessBuilder("C:\\kafka_2.12-2.2.0\\bin\\windows\\zookeeper-server-start.bat",
  "C:\\kafka_2.12-2.2.0\\config\\zookeeper.properties").start();
      InputStream is = process.getInputStream();
      InputStreamReader isr = new InputStreamReader(is);
      BufferedReader br = new BufferedReader(isr);
      String line;
  
      while ((line = br.readLine()) != null) {
        System.out.println(line);
      }
  </code></pre>
  
  <p>But this seems not working, since nothing is printed on the console and after a while the application throws a TimeOutException.   </p>
  
  <p>Second, I would like to have the kafka server to run after Zookeeper has started; how can one achieve this?</p>