I am trying to get a colored output in my Netbeans output window.
Ansi-Output in Linux and Windows console works perfectly fine. However not in the IDE.
Is there a way to make this work in Netbeans' output window?
According to this https://netbeans.org/bugzilla/show_bug.cgi?id=214546 it should work, but it doesn't in my current Netbeans 8.0.1 installation (neither Linux nor Windows).
Any hints on how to do that?
I went to tools->options->miscellaneous->output and changed the background color. :) great..
Try to run the code on cmd and try. If it runs successfully, check if you are executing the java class or the project in total. That may be the reason of no output. Else then try reinstalling your NetBeans IDE.
I am using Netbeans 8.0.1 myself, on Windows 7. I just tried ANSI escape code, and it works. Example:
String greenBold = "\033[32;1m";
String reset = "\033[0m";
System.out.println("before" + greenBold + " green " + reset + "after");
There seems to be a problem when using Maven 3.5.x.
See:
I tried NB 8.2 with the old Maven 3.3.9 first and it worked fine out of the box. The whole output remained as it had been but my application's own logs were colored as expected.
With Maven 3.5.2 and 3.5.4 the colors didn't work at all. So I had to set MAVEN_OPTS environment variable to "-Djansi.passthrough=true" (as suggested in the first link) and restart NetBeans. The problem is that now the whole output is colored differently and error stack traces don't contain links to code any more. So I'm switching back.
BTW. When using log4j2's %highlight{}
, I also had to set disableAnsi="false"
to get the desired effect:
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %highlight{%-5level} [%t] %location --- %msg%n%throwable" disableAnsi="false" />
</Console>
I'm using NetBeans 12.3 and I had same problem. Problem is with bundled Maven (version 3.6.3). When I changed to Maven which I installed on my system it works. Note that version of Maven installed on my system is the same as the bundled one - 3.6.3.
I have changed location of Maven in settings:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With