如何从 ANT NetBeans 平台应用程序获取要在调试器控制台中显示的输出

问题描述

我们的应用程序是一个使用 ANT 构建的 NetBeans 平台应用程序。由于我们将应用程序更新到 NetBeans 11,输出(日志消息、异常等)不再显示在“输出”窗口中,只能在 var/log 中找到。

使用 ANT 创建新的 ANT NetBeans 平台应用程序会产生相同的行为,而使用 Maven 创建一个会在调试期间产生预期的输出

是否可以让 ANT 构建的 NetBeans 平台应用程序在输出窗口中显示输出

解决方法

我遇到了同样的问题,我假设您使用的是 Windows x64。您需要修补 run.xml,这是 Netbeans_installation_directory/harness 目录中的构建脚本。

 <!-- architecture of jvm on which app will run -->
 <!-- ORIGINAL: condition property="jvm.arch.string" value="64" else="" -->
 <!-- BUG FIX: make sure jvm.arch.string=64,otherwise no log output on console on Windows with JDKx64! -->                
 <condition property="jvm.arch.string" value="64" else="64">
      <available file="${run.jdkhome}\jre\lib\amd64" />
 </condition>