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

孤街浪徒 提交于 2019-12-07 06:13:20

问题


When I write a Java code in IntelliJ IDEA and runs it, IntelliJ compiles the Java file, a class file is extracted and then the class file is run.

How can I see the javac command line that IntelliJ runs. I ask it so I can see whether IntelliJ adds some flags to the javac command.


回答1:


IntelliJ IDEA doesn't run javac, therefore you can't see the command line.

Compiler API is used directly from Java code. If you enable debug logging for build.log file, you may find some more details how the modified and dependent files are compiled and what options are used.

Sample debug log line:

[  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" 



回答2:


IDEA is not running java binary, so there is no way to see the commands. Instead, IDEA uses Java compiler API directly.

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.




回答3:


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

When you build inside IDEA, it writes a log to build.log in this directory.

IDEA is not running java binary, so there is no way to see the commands.



来源:https://stackoverflow.com/questions/43855119/how-can-i-see-the-javac-command-intellij-idea-uses-to-compile-my-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!