3

JDK 在 Windows11 系统上运行创建`NUL:`文件报错,有哪位大佬知道是什么问题吗?

 1 year ago
source link: https://www.v2ex.com/t/862878
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Java

JDK 在 Windows11 系统上运行创建`NUL:`文件报错,有哪位大佬知道是什么问题吗?

  ouyc · 1 小时 37 分钟前 · 202 次点击

JDK 在 Windows11 系统上运行创建NUL:文件报错

在 Windows10 系统上运行正常

public class Main {

    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("NUL:");

    }
}

Windows11 上的报错信息

Exception in thread "main" java.io.FileNotFoundException: Invalid file path
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:229)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:123)
	at com.company.Main.main(Main.java:9)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK