On Windows, NUL is the null output device similar to /dev/null on Linux.
With Oracle Java 8 Update 331, trying to get a new FileOutputStream("NUL:")
throws an exception. Previously (Java 8u321) it worked fine.
The problem seems to be the colon:
new FileOutputStream("NUL")
- OKnew FileOutputStream("NUL:")
- exception
Can anyone point me to docs or JDK sources regarding this change? I can't change the code itself because it is in a 3rd party lib (xnio-api).
try
{
new FileOutputStream("NUL:");
System.out.println("OK");
}
catch (FileNotFoundException e)
{
System.out.println(e);
}
I suspect this is the offending change.
Apparently it tries to avoid accessing ADS (alternate data streams), but seems to "accidentally" also prevent access to device-files like this.
If that's correct, then you can try setting the system property
jdk.io.File.enableADS
totrue
to re-enable the old behaviour.