如何查看 IntelliJ IDEA 用于编译我的代码的 javac 命令?

How can I see the javac command IntelliJ IDEA uses to compile my code?

当我在 IntelliJ IDEA 中编写 Java 代码并 运行 时,IntelliJ 编译 Java 文件,提取 class 文件,然后 class 文件是 运行。

如何查看 IntelliJ 运行s 的 javac 命令行。我问它是为了看看 IntelliJ 是否向 javac 命令添加了一些标志。

IntelliJ IDEA 没有 运行 javac,因此您看不到命令​​行。

编译器 API 直接从 Java 代码使用。如果你 enable debug logging for build.log 文件,你可能会发现更多细节如何编译修改和依赖文件以及使用什么选项。

示例调试日志行:

[  41011]  DEBUG - s.incremental.java.JavaBuilder - Compiling chunk [stopme] with options: "-g -deprecation -proceedOnError -encoding UTF-8 -source 1.8 -target 1.8 -proc:none" 

IDEA不是运行java二进制的,所以没办法看到命令。相反,IDEA 直接使用 Java 编译器 API。

If you want a raw representation of what is done to build the project, you can use Build | Generate Ant build. Examine the build file or run it from the command line via Ant to see what happens and what options/commands are invoked.

/Users/itsabhiaryan/Library/Logs/IdeaIC2017.1/build-log

中查找

当您在 IDEA 内部构建时,它会将日志写入此目录中的 build.log。

IDEA 不是 运行 java 二进制文件,因此无法查看命令。