Package com.caucho.java

Examples of com.caucho.java.JavaCompiler


      javaFiles[i] = name;
    }
    _pendingClassNames.clear();

    EntityGenerator gen = new EntityGenerator();
    JavaCompiler compiler = gen.getCompiler();

    compiler.compileBatch(javaFiles);
  }
View Full Code Here


    EntityGenerator gen = new EntityGenerator();
    gen.setSearchPath(_configDirectory);
    // XXX:
    // gen.setClassDir(getPath());

    JavaCompiler compiler = gen.getCompiler();

    compiler.setClassDir(getWorkDir());
    compiler.compileBatch(javaFiles);

    for (int i = 0; i < classNames.size(); i++) {
      String extClassName = classNames.get(i);
      int tail = extClassName.length() - "__ResinExt".length();
View Full Code Here

      scriptPath = mergePath;
    }
   
    block = null;

    JavaCompiler compiler = JavaCompiler.create(getClassLoader());
    compiler.setClassDir(workPath);

    parseClass = new ParseClass(name, className);
    parseClass.setParser(this);
    if (is.getPath() != null && is.getPath().getLastModified() > 0)
      parseClass.setSourcePath(is.getPath());

    globalFunction = parseClass.newFunction(null, ESId.intern("global"), false);
    globalFunction.setFast(isFast);
    staticFunction = parseClass.newFunction(null, ESId.intern("__es_static"), false);
    parseClass.setGlobal(globalFunction);

    if (isEval) {
      block = Block.create(this, globalFunction);
      block.finish();
      function = parseClass.newFunction(globalFunction, ESId.intern("eval"), false);
      function.setEval();
    }
    else
      function = globalFunction;
   
    block = Block.create(this, function);
    parseBlock(true);
    block.finish();

    if (lexer.peek() != Lexer.EOF)
      throw expect(L.l("end of file"));

    block = Block.create(this, staticFunction);
    block.finish();

    synchronized (LOCK) {
      Path path = workPath.lookup(className.replace('.', '/') + ".java");
      path.getParent().mkdirs();
   
      WriteStream os = path.openWrite();
      os.setEncoding("JAVA");
      parseClass.writeCode(os);
      os.close();

      Script script;
      try {
        compiler.compile(className.replace('.', '/') + ".java", null);
        script = loadScript(className);
      } catch (Exception e) {
        throw new ESParseException(e);
      }
View Full Code Here

  private void compileJava(Path path, String className,
                           LineMap lineMap, String charEncoding)
    throws Exception
  {
    JavaCompiler compiler = JavaCompiler.create(null);
    compiler.setClassDir(_jspCompiler.getClassDir());
    // compiler.setEncoding(charEncoding);
    String fileName = className.replace('.', '/') + ".java";

    compiler.compile(fileName, lineMap);

    /*
    boolean remove = true;
    try {
      compiler.compile(fileName, lineMap);
View Full Code Here

        _classes.toArray(files);
        _classes.clear();
      }

      try {
        JavaCompiler javaCompiler = JavaCompiler.create(null);
        javaCompiler.setClassDir(_compiler.getClassDir());

        javaCompiler.compileBatch(files);
      } catch (Exception e) {
        if (e instanceof CompileException)
          log.warning(e.getMessage());
        else
          log.log(Level.WARNING, e.toString(), e);
View Full Code Here

      javaFiles[i] = name;
    }
    _pendingClassNames.clear();

    EntityGenerator gen = new EntityGenerator();
    JavaCompiler compiler = gen.getCompiler();

    compiler.compileBatch(javaFiles);
  }
View Full Code Here

    EntityGenerator gen = new EntityGenerator();
    gen.setSearchPath(_configDirectory);
    // XXX:
    // gen.setClassDir(getPath());

    JavaCompiler compiler = gen.getCompiler();

    compiler.setClassDir(getWorkDir());
    compiler.compileBatch(javaFiles);

    for (int i = 0; i < classNames.size(); i++) {
      String extClassName = classNames.get(i);
      int tail = extClassName.length() - "__ResinExt".length();
View Full Code Here

  private void compileJava(Path path, String className,
                           LineMap lineMap, String charEncoding)
    throws Exception
  {
    JavaCompiler compiler = JavaCompiler.create(null);
    compiler.setClassDir(_jspCompiler.getClassDir());
    // compiler.setEncoding(charEncoding);
    String fileName = className.replace('.', '/') + ".java";

    compiler.compile(fileName, lineMap);

    /*
    boolean remove = true;
    try {
      compiler.compile(fileName, lineMap);
View Full Code Here

  _classes.toArray(files);
  _classes.clear();
      }

      try {
  JavaCompiler javaCompiler = JavaCompiler.create(null);
  javaCompiler.setClassDir(_compiler.getClassDir());

  javaCompiler.compileBatch(files);
      } catch (Exception e) {
  if (e instanceof CompileException)
    log.warning(e.getMessage());
  else
    log.log(Level.WARNING, e.toString(), e);
View Full Code Here

   * Compiles the class.
   */
  public void compileJava(String fullClassName)
    throws IOException, ClassNotFoundException
  {
    JavaCompiler compiler = JavaCompiler.create(getPreloadLoader());

    compiler.setClassLoader(getPreloadLoader());
    compiler.setClassDir(getWorkDir());

    if (_encoding != null)
      compiler.setEncoding(_encoding);

    compiler.compile(fullClassName.replace('.', '/') + ".java", null);
  }
View Full Code Here

TOP

Related Classes of com.caucho.java.JavaCompiler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.