Exemple #1
0
 public JoodoServlet() {
   try {
     final Var var = loadVar("joodo.kake.servlet", "initialize-joodo-servlet");
     var.invoke(this);
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException(e);
   }
 }
Exemple #2
0
  public static void main(String... args) throws IOException {

    OutputStreamWriter out = (OutputStreamWriter) RT.OUT.deref();
    PrintWriter err = RT.errPrintWriter();
    String path = System.getProperty(PATH_PROP);
    int count = args.length;

    if (path == null) {
      err.println(
          "ERROR: Must set system property "
              + PATH_PROP
              + "\nto the location for compiled .class files."
              + "\nThis directory must also be on your CLASSPATH.");
      System.exit(1);
    }

    boolean warnOnReflection = System.getProperty(REFLECTION_WARNING_PROP, "false").equals("true");
    String uncheckedMathProp = System.getProperty(UNCHECKED_MATH_PROP);
    Object uncheckedMath = Boolean.FALSE;
    if ("true".equals(uncheckedMathProp)) uncheckedMath = Boolean.TRUE;
    else if ("warn-on-boxed".equals(uncheckedMathProp))
      uncheckedMath = Keyword.intern("warn-on-boxed");

    try {
      Var.pushThreadBindings(
          RT.map(
              compile_path,
              path,
              warn_on_reflection,
              warnOnReflection,
              unchecked_math,
              uncheckedMath));

      for (String lib : args) {
        out.write("Compiling " + lib + " to " + path + '\n');
        out.flush();
        compile.invoke(Symbol.intern(lib));
      }
    } finally {
      Var.popThreadBindings();
      try {
        out.flush();
      } catch (IOException e) {
        e.printStackTrace(err);
      }
    }
  }