它的javac.exe用于蚂蚁javac任务? [英] Which javac.exe is used by ant javac task?

查看:152
本文介绍了它的javac.exe用于蚂蚁javac任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在面临一个问题。我改名的javac.exe 我的机器上,发现蚂蚁的javac 任务仍然正常工作。

I am facing one problem. I renamed javac.exe on my machine and noticed that ant javac task still works fine.

有谁从知道其获得的javac.exe?

Does anybody know from where its getting javac.exe?

推荐答案

其实,我相信,在默认情况下蚂蚁尝试直接用这个code执行Java编译器类:

Actually, I believe, that by default Ant tries to execute the java compiler class directly with this code:

try {
        Class c = Class.forName ("com.sun.tools.javac.Main");
        Object compiler = c.newInstance ();
        Method compile = c.getMethod ("compile",
            new Class [] {(new String [] {}).getClass ()});
        int result = ((Integer) compile.invoke
                      (compiler, new Object[] {cmd.getArguments()}))
            .intValue ();
        return (result == MODERN_COMPILER_SUCCESS);

    } catch (Exception ex) {
        if (ex instanceof BuildException) {
            throw (BuildException) ex;
        } else {
            throw new BuildException("Error starting modern compiler",
                                     ex, location);
        }
    }

在code从<一来到href=\"http://grep$c$c.com/file/repo1.maven.org/maven2/org.apache.ant/ant/1.8.3/org/apache/tools/ant/taskdefs/compilers/Javac13.java#Javac13\">here.

这意味着,如果库tools.jar是关于一些蚂蚁的当前classpath,它会皮卡类,并启动它。这导致的事实的javac.exe可以重命名为任何你想要的,它仍然会正常工作。因此,要回答你的问题,它实际上没有执行任何的javac.exe。

Which means that if the library tools.jar is on the current classpath of Ant, it will pickup the class and launch it. This results in the fact that javac.exe can be renamed to whatever you want, it will still work. So to answer your question, it actually executes none of any "javac.exe".

有javac任务的其它实现,但我认为这是默认的所有编译器1.3 +

There are other implementations of the Javac task, but I think this is the default one for all compilers 1.3+

这篇关于它的javac.exe用于蚂蚁javac任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆