简体   繁体   English

Java 是否有调试/发布?

[英]Is there debug/release for Java?

I created a new gradle java project on Intellij IDEA and wanted to test performance.我在Intellij IDEA上新建了一个gradle java项目,想测试一下性能。 I can't find the switch from debug to release.我找不到从调试到发布的开关。

I know on Android this exists but android uses ART to compile things ahead of time so debugging makes sense.我知道在 Android 上存在这种情况,但 android 使用 ART 提前编译,因此调试很有意义。

What about pure java desktop applications?纯 java 桌面应用程序呢? How can I run a gradle java application in release mode?如何在发布模式下运行 gradle java 应用程序?

There are compiler flags to add debug information to the bytecode, so stack traces can have line numbers, for example.有编译器标志可以将调试信息添加到字节码,因此堆栈跟踪可以有行号,例如。 The code is no different though.代码没有什么不同。 The debug flags for the JVM are all about configuring it to accept connections to a debugging interface. JVM 的调试标志都是关于将其配置为接受到调试接口的连接。 There is a -Xdebug flag, but in recent JVMs it doesn't do anything.有一个 -Xdebug 标志,但在最近的 JVM 中它什么都不做。

There are flags you can tweak to make the just-in-time compiler more or less aggressive.您可以调整一些标志来使即时编译器或多或少具有侵略性。 If you are asking because you want the best performance, there are plenty of runtime flags to tweak, but not much for compile time that I am aware of.如果你问是因为你想要最好的性能,有很多运行时标志可以调整,但我知道的编译时间并不多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM