Create NTFS junction point from Scala or Java.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

scala-junction is an utility that creates NTFS junction points on Windows for Scala or Java.

How to use it?

If you use sbt, add following lines to you build.sbt:

libraryDependencies += "com.dongxiguo" %% "scala-junction" % "0.1.0"

The API of scala-junction is quite simple. There are only three public static functions:

com.dongxiguo.junction.Junction.createJunction(new"my-link"), new"D:\\target"));

// Or if you are using Java 7:
com.dongxiguo.junction.java7.Junction.createJunction(java.nio.file.Paths.get("my-link"), java.nio.file.Paths.get("D:\\target"));

// Create junction only if failed to create a symblic link:
com.dongxiguo.junction.java7.Junction.createSymbolicLinkOrJunction(java.nio.file.Paths.get("my-link"), java.nio.file.Paths.get("D:\\target"));

What's the difference between symblic links and junctions?

Java 7 supports symblic links, but symblic links can only be created on POSIX, or by elevated user on Windows Vista/7/2008. On the other hand, scala-junction is tested working on Windows XP and Windows 7 (for both elevated user and non-elevated user). I guess scala-junction works on any version of Windows NT.