import static javax.measure.unit.SI.KILOGRAM;
import javax.measure.quantity.Mass;
import org.jscience.physics.model.RelativisticModel;
import org.jscience.physics.amount.Amount;

import java.sql.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;

import java.net.URI;
import java.net.URISyntaxException;

import static spark.Spark.*;
import spark.template.freemarker.FreeMarkerEngine;
import spark.ModelAndView;
import static spark.Spark.get;

import com.heroku.sdk.jdbc.DatabaseUrl;

public class Main {

  public static void main(String[] args) {

    port(Integer.valueOf(System.getenv("PORT")));
    staticFileLocation("/public");

    get("/hello", (req, res) -> {
      RelativisticModel.select();
      Amount<Mass> m = Amount.valueOf("12 GeV").to(KILOGRAM);
      return "E=mc^2: 12 GeV = " + m.toString();
    });

    get("/", (request, response) -> {
            Map<String, Object> attributes = new HashMap<>();
            attributes.put("message", "Hello World!");

            return new ModelAndView(attributes, "index.ftl");
        }, new FreeMarkerEngine());

    get("/db", (req, res) -> {
      Connection connection = null;
      Map<String, Object> attributes = new HashMap<>();
      try {
        connection = DatabaseUrl.extract().getConnection();

        Statement stmt = connection.createStatement();
        stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)");
        stmt.executeUpdate("INSERT INTO ticks VALUES (now())");
        ResultSet rs = stmt.executeQuery("SELECT tick FROM ticks");

        ArrayList<String> output = new ArrayList<String>();
        while (rs.next()) {
          output.add( "Read from DB: " + rs.getTimestamp("tick"));
        }

        attributes.put("results", output);
        return new ModelAndView(attributes, "db.ftl");
      } catch (Exception e) {
        attributes.put("message", "There was an error: " + e);
        return new ModelAndView(attributes, "error.ftl");
      } finally {
        if (connection != null) try{connection.close();} catch(SQLException e){}
      }
    }, new FreeMarkerEngine());

  }

}

@@ -1,517 +1,4 @@
-import static javax.measure.unit.SI.KILOGRAM;%0Aimport javax.measure.quantity.Mass;%0Aimport org.jscience.physics.model.RelativisticModel;%0Aimport org.jscience.physics.amount.Amount;%0A%0Aimport java.sql.*;%0Aimport java.util.HashMap;%0Aimport java.util.ArrayList;%0Aimport java.util.Map;%0A%0Aimport java.net.URI;%0Aimport java.net.URISyntaxException;%0A%0Aimport static spark.Spark.*;%0Aimport spark.template.freemarker.FreeMarkerEngine;%0Aimport spark.ModelAndView;%0Aimport static spark.Spark.get;%0A%0Aimport com.heroku.sdk.jdbc.DatabaseUrl;%0A%0A
 publ
@@ -10,19 +10,17 @@
 ass Main
- %7B%0A
+%7B
 %0A  publi
@@ -56,1564 +56,51 @@
 rgs)
- %7B%0A
+%7B
 %0A    
-port(Integer.valueOf(System.getenv(%22PORT%22)));%0A    staticFileLocation(%22/public%22);%0A%0A    get(%22/hello%22, (req, res) -%3E %7B%0A      RelativisticModel.select();%0A      Amount%3CMass%3E m = Amount.valueOf(%2212 GeV%22).to(KILOGRAM);%0A      return %22E=mc%5E2: 12 GeV = %22 + m.toString();%0A    %7D);%0A%0A    get(%22/%22, (request, response) -%3E %7B%0A            Map%3CString, Object%3E attributes = new HashMap%3C%3E();%0A            attributes.put(%22message%22, %22Hello World!%22);%0A%0A            return new ModelAndView(attributes, %22index.ftl%22);%0A        %7D, new FreeMarkerEngine());%0A%0A    get(%22/db%22, (req, res) -%3E %7B%0A      Connection connection = null;%0A      Map%3CString, Object%3E attributes = new HashMap%3C%3E();%0A      try %7B%0A        connection = DatabaseUrl.extract().getConnection();%0A%0A        Statement stmt = connection.createStatement();%0A        stmt.executeUpdate(%22CREATE TABLE IF NOT EXISTS ticks (tick timestamp)%22);%0A        stmt.executeUpdate(%22INSERT INTO ticks VALUES (now())%22);%0A        ResultSet rs = stmt.executeQuery(%22SELECT tick FROM ticks%22);%0A%0A        ArrayList%3CString%3E output = new ArrayList%3CString%3E();%0A        while (rs.next()) %7B%0A          output.add( %22Read from DB: %22 + rs.getTimestamp(%22tick%22));%0A        %7D%0A%0A        attributes.put(%22results%22, output);%0A        return new ModelAndView(attributes, %22db.ftl%22);%0A      %7D catch (Exception e) %7B%0A        attributes.put(%22message%22, %22There was an error: %22 + e);%0A        return new ModelAndView(attributes, %22error.ftl%22);%0A      %7D finally %7B%0A        if (connection != null) try%7Bconnection.close();%7D catch(SQLException e)%7B%7D%0A      %7D%0A    %7D, new FreeMarkerEngine());%0A%0A  %7D%0A
+System.out.println(%22Hello World%22);%0A  %7D
 %0A%7D%0A

Update Main.java