Creating a Windows symlink with Java (equivalent to MKLINK)

Can someone tell me how to make a symbolic link (just like MKLINK does) and / or remove the symbolic link from Java. I found solutions that use Java as a shell and use their own Windows program to run this program, but I really want a clean solution for Java. Thank you in advance!

+4
source share
2 answers

Starting with Java 7, you can easily do this with the NIO package.

Path target = Paths.get("target");
Path link = Paths.get("link");
Files.createDirectory(target);
Files.createSymbolicLink(link, target);

, . unit test eclipse , ( , cmd.exe)

+5

, , Unix- .

Windows :

  • , .. . WMI. WMI java, , JaWin, Jinterop, Jintegra WMI script JScript o VBScript, Java.

  • subst, . Unix.

  • . . ( INI). , java. , .

0

All Articles