@Test public void testSymlink() throws IOException{ if(!isUnix()) return; File f = File.createTempFile("testSymlink", ".test"); File d = new File(f.getParentFile(), f.getName()+".dir"); d.mkdir(); File a = new File(d, "a"); a.createNewFile(); File b = new File(d, "b"); int result = Unix.symlink(a.getPath(), b.getPath()); assertTrue(result == 0); assertTrue(b.exists()); }
native static int symlink(String linkedToPath, String symlinkPath);
Unix { native static int symlink(String linkedToPath, String symlinkPath); }
Unix { native static int symlink(String linkedToPath, String symlinkPath);  }
Unix { native static int symlink(String linkedToPath, String symlinkPath);   }
Unix { native static int symlink(String linkedToPath, String symlinkPath);    }