import codeu.chat.ServerMain;
import codeu.chat.common.User;
import models.DBUtility;
import models.Models;
import play.GlobalSettings;
import play.Application;

import java.sql.DriverManager;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Play's Global class, which runs custom code when the application starts / ends.
 */
public class Global extends GlobalSettings {

  /**
   * Setting up the application when it starts by adding default user and chatrooms to the database.
   * @param app this application.
   */
  public void onStart(Application app) {

    // run "sh run_server.sh" in background
    ExecutorService service = Executors.newFixedThreadPool(4);
    service.submit(new Runnable() {
      public void run() {
        ServerMain.runServer();
      }
    });

    // connect to the database
    try {
      String url = "jdbc:sqlite:chatapp.db";
      String driver = "org.sqlite.JDBC";
      Class.forName(driver);

      // set up initial database if it's empty
      boolean adminExists = DBUtility.checkDuplicateField(DriverManager.getConnection(url), "users", "name", "admin");
      if (!adminExists) {
        // create a default admin account
        User admin = Models.newUser("admin");
        DBUtility.addUser(DriverManager.getConnection(url), "admin", "123456", admin.id.toString());
      }

      // create a default public room
      DBUtility.addConversation(DriverManager.getConnection(url), "public", "admin");

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

@@ -189,92 +189,8 @@
 ger;
-%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;
 %0A%0A/*
@@ -517,226 +517,8 @@
  %7B%0A%0A
-    // run %22sh run_server.sh%22 in background%0A    ExecutorService service = Executors.newFixedThreadPool(4);%0A    service.submit(new Runnable() %7B%0A      public void run() %7B%0A        ServerMain.runServer();%0A      %7D%0A    %7D);%0A%0A
     
@@ -1183,16 +1183,92 @@
 admin%22);
+%0A      DBUtility.makeRoomPublic(DriverManager.getConnection(url), %22public%22);
 %0A%0A    %7D 

Remove code to run server (it should be run on a separate terminal tab).