Examples of JavaCompiler


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

Examples of com.caucho.java.JavaCompiler

    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

Examples of com.caucho.java.JavaCompiler

      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

Examples of com.caucho.java.JavaCompiler

  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

Examples of com.caucho.java.JavaCompiler

        _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

Examples of com.sun.tools.javac.main.JavaCompiler

    }
    Name typeName = getName(typeStr);
    try {
      ClassSymbol typeSymbol = getSymtab().classes.get(typeName);
      if (typeSymbol == null) {
        JavaCompiler compiler = JavaCompiler.instance(context);
        Symbol sym = compiler.resolveIdent(typeStr);
        if (!(sym instanceof ClassSymbol)) {
          return null;
        }
        typeSymbol = (ClassSymbol) sym;
      }
View Full Code Here

Examples of javax.tools.JavaCompiler

    List<File> javaFiles = new ArrayList<File>();
    for (OutputFile o : outputs) {
      javaFiles.add(o.writeToDestination(null, dstDir));
    }

    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fileManager =
      compiler.getStandardFileManager(null, null, null);
   
    CompilationTask cTask = compiler.getTask(null, fileManager, null, null,
        null,
        fileManager.getJavaFileObjects(
            javaFiles.toArray(new File[javaFiles.size()])));
    assertTrue(cTask.call());
  }
View Full Code Here

Examples of javax.tools.JavaCompiler

        if (outputPath.isDirectory() == false && outputPath.mkdirs() == false) {
            throw new IOException(MessageFormat.format(
                    "Failed to create {0}",
                    outputPath));
        }
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        if (compiler == null) {
            throw new IOException("Failed to create a compiler");
        }
        StandardJavaFileManager files = compiler.getStandardFileManager(null, null, encoding);
        try {
            CompilationTask task = compiler.getTask(
                    null,
                    files,
                    null,
                    arguments,
                    Collections.<String>emptyList(),
View Full Code Here

Examples of javax.tools.JavaCompiler

        }
    }

    private void compile() throws IOException {
        LOG.debug("生成されたプログラムをクラスファイルに変換します");
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        if (compiler == null) {
            throw new IllegalStateException(
                    "この環境ではJavaコンパイラーを利用できません (JREにはコンパイラーが含まれていません)");
        }
        if (sourceDirectory.isDirectory() == false) {
View Full Code Here

Examples of javax.tools.JavaCompiler

            jar.closeEntry();
        }
    }

    private void compile(JarOutputStream jar) throws IOException {
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        if (compiler == null) {
            throw new IllegalStateException(
                    "この環境ではJavaコンパイラーを利用できません (JREにはコンパイラーが含まれていません)");
        }
        compile(compiler, jar);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.