zoukankan      html  css  js  c++  java
  • Atitit.java eval功能的实现  Compiler API

    Atitit.java eval功能的实现  Compiler API

     

    输出echo2

    输出目录配置2

     

    针对编译器,JDK 设计了两个接口,分别是 JavaCompiler JavaCompiler.CompilationTask

     

     

    private static void T() throws FileNotFoundException {

    //String fullQuanlifiedFileName = "compile" + java.io.File.separator +

    //        "Target.java";     

    String fullQuanlifiedFileName=pathx.prjPath()+"/src/aaaaaCompiler/Target.java";

      JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

     

    //  FileOutputStream err = new FileOutputStream("err.txt");

    // com.sun.tools.javac.api.JavacTool @2133c8f8  ==compiler  ,

      String string = "-Xlint:deprecation ";

      string ="-d c:\00output";

    int compilationResult = compiler.run(null, null, null,"-d","c:\00output", fullQuanlifiedFileName);

     

      if(compilationResult == 0){

        System.out.println("Done");

      } else {

        System.out.println("Fail");

      }

    }

     

    javac: 找不到文件: compileTarget.java

    用法: javac <options> <source files>

    -help 用于列出可能的选项

    Fail

     

    输出echo

    int compilationResult = compiler.run(null, null, null,"-d","c:\00output", fullQuanlifiedFileName);

     

    输出目录配置

     

    作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 

    汉字名:艾提拉(艾龙)   EMAIL:1466519819@qq.com

    转载请注明来源: http://www.cnblogs.com/attilax/

     

     

    参考资料

    Java SE 6 新特性_ 编译器 API.html

    java动态编译笔记 - 天魂地煞 - 博客园.html

    Atiend

     

  • 相关阅读:
    【翻译】How To Tango With Django 1.5.4 第五章
    【翻译】How To Tango With Django 1.5.4 第四章
    阅读廖雪峰老师git教程笔记
    【翻译】How To Tango With Django 1.5.4 第二章
    Spring MVC @PathVariable 特殊字符
    http 缓存相关
    response contentType
    c++ 中 define
    转:java native
    浅析Java中的final关键字
  • 原文地址:https://www.cnblogs.com/attilax/p/5931899.html
Copyright © 2011-2022 走看看