diff --git a/build.xml b/build.xml
index a2945b1e..3a608ffc 100644
--- a/build.xml
+++ b/build.xml
@@ -21,7 +21,7 @@
-
+
@@ -29,7 +29,7 @@
-
+
diff --git a/src/org/ohdsi/utilities/RabbitInAHatLauncher.java b/src/org/ohdsi/utilities/RabbitInAHatLauncher.java
new file mode 100644
index 00000000..75e39681
--- /dev/null
+++ b/src/org/ohdsi/utilities/RabbitInAHatLauncher.java
@@ -0,0 +1,25 @@
+package org.ohdsi.utilities;
+
+import org.ohdsi.rabbitInAHat.RabbitInAHatMain;
+
+/* Adapted from code found on:
+ * http://silentdevelopment.blogspot.com/2010/03/how-to-set-or-increase-xmx-heap-memory.html
+ */
+public class RabbitInAHatLauncher {
+ private final static int MIN_HEAP = 1500;
+
+ public static void main(String[] args) throws Exception {
+
+ float heapSizeMegs = (Runtime.getRuntime().maxMemory() / 1024) / 1024;
+
+ if (heapSizeMegs > MIN_HEAP) {
+ System.out.println("Launching with current VM");
+ RabbitInAHatMain.main(args);
+ } else {
+ System.out.println("Starting new VM");
+ String pathToJar = RabbitInAHatMain.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
+ ProcessBuilder pb = new ProcessBuilder("java", "-Xmx" + MIN_HEAP + "m", "-classpath", pathToJar, "org.ohdsi.rabbitInAHat.RabbitInAHatMain");
+ pb.start();
+ }
+ }
+}
diff --git a/src/org/ohdsi/utilities/WhiteRabbitLauncher.java b/src/org/ohdsi/utilities/WhiteRabbitLauncher.java
new file mode 100644
index 00000000..340dfb12
--- /dev/null
+++ b/src/org/ohdsi/utilities/WhiteRabbitLauncher.java
@@ -0,0 +1,25 @@
+package org.ohdsi.utilities;
+
+import org.ohdsi.whiteRabbit.WhiteRabbitMain;
+
+/* Adapted from code found on:
+ * http://silentdevelopment.blogspot.com/2010/03/how-to-set-or-increase-xmx-heap-memory.html
+ */
+public class WhiteRabbitLauncher {
+ private final static int MIN_HEAP = 1500;
+
+ public static void main(String[] args) throws Exception {
+
+ float heapSizeMegs = (Runtime.getRuntime().maxMemory() / 1024) / 1024;
+
+ if (heapSizeMegs > MIN_HEAP) {
+ System.out.println("Launching with current VM");
+ WhiteRabbitMain.main(args);
+ } else {
+ System.out.println("Starting new VM");
+ String pathToJar = WhiteRabbitMain.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
+ ProcessBuilder pb = new ProcessBuilder("java", "-Xmx" + MIN_HEAP + "m", "-classpath", pathToJar, "org.ohdsi.whiteRabbit.WhiteRabbitMain");
+ pb.start();
+ }
+ }
+}