Creating a Hard Link in java

后端 未结 5 1045
栀梦
栀梦 2021-01-11 12:51

Currently I use \'ln\' command via Runtime.exec(). It works fine. The only problem is that in order to do this fork, we need twice the heap space o

5条回答
  •  一生所求
    2021-01-11 13:22

    It’s easy in Java 7 using createLink:

    Files.createLink(Paths.get("newlink"), Paths.get("existing"));
    

提交回复
热议问题