Java 15.0.2 (Adopt Open JDK)
A simple Java Ant project in NetBeans 12.4 (using Java 15) does not execute the static code block, when the project is executed from within the IDE.
Steps to reproduce:
File > New Project > Java with Ant
Create two classes:
(Whenever I try to format the below code, it looks completely wrong in the ticket, so it's just presented as plain text - sorry I do not know how this system handles code snippets).
When the project is run from within the IDE, the output is "0". The static block in Test is not executed.
The expected output is "10". The static block in Test is executed.
The JAR built by the project runs correctly, when executed from the command line, outside of the IDE.
The same code shown above also runs as expected in the IDE when built using a Java Maven project, instead of a Java Ant project.
This behavior does not appear when executing the same code, using NetBeans 12.0 and Java 11.