<div dir="ltr">Hi, this is a bug report.<div><br></div><div>Here is a tiny program that does class loading:</div><div><br></div><div><div>public class LoadClass {</div><div>    public static void main(String[] args) throws Throwable {</div>
<div>        for (String className : args)</div><div>            Class.forName(className, true, null);</div><div>    }</div><div>}</div></div><div><br></div><div>If I run this against 1.7.0_21, it succeeds, but if I run it against 1.7.0_25 I get</div>
<div><br></div><div>java LoadClass <a href="http://sun.nio.ch.Net">sun.nio.ch.Net</a></div><div>Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.nio.ch.Net.isExclusiveBindAvailable()I</div><div><span class="" style="white-space:pre">       </span>at sun.nio.ch.Net.isExclusiveBindAvailable(Native Method)</div>
<div><span class="" style="white-space:pre">    </span>at <a href="http://sun.nio.ch.Net">sun.nio.ch.Net</a>.<clinit>(Net.java:58)</div><div><span class="" style="white-space:pre">    </span>at java.lang.Class.forName0(Native Method)</div>
<div><span class="" style="white-space:pre">    </span>at java.lang.Class.forName(Class.java:270)</div><div><br></div><div><a href="http://sun.nio.ch.Net">sun.nio.ch.Net</a> clearly tries to prevent this from happening by calling Util.load(), but the problem is that the static block is called too late.  Those static blocks calling Util.load() need to be at the top of each source file instead of the bottom, to prevent such failures.<br>
</div><div><br></div><div>Regression was introduced with this changeset:</div><div><br></div><div><div>changeset:   6272:8dd8266a2f4b</div><div>user:        khazra</div><div>date:        Thu Mar 14 13:54:32 2013 -0700</div>
<div>summary:     7170730: Improve Windows network stack support.</div></div><div><br></div><div>I think Oracle testing folks should regularly run the above little program against every single class in the JDK (although it might be too expensive to run in a jtreg test).</div>
<div><br></div><div>The fix is obvious, but I can provide a webrev if desired.</div></div>