gpt4 book ai didi

java - 到底什么是链接(符号或其他)

转载 作者:行者123 更新时间:2023-12-02 07:10:00 27 4
gpt4 key购买 nike

我正在使用 NIO.2 开发一个 java 项目,并且遇到了 Files.createLink 方法。在对 Java 教程进行一些研究后,我发现这些看起来与 Windows 快捷方式类似,但我不确定它们是否就是这样。如果不是,我如何创建一种独立于平台的方式来创建快捷方式?

最佳答案

创建符号链接(symbolic link)

If your file system supports it, you can create a symbolic link by using the createSymbolicLink(Path, Path, FileAttribute) method. The second Path argument represents the target file or directory and might or might not exist. The following code snippet creates a symbolic link with default permissions:

来源: http://docs.oracle.com/javase/tutorial/essential/io/links.html

关于java - 到底什么是链接(符号或其他),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15646691/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com