作者:鱼咸4406 | 来源:互联网 | 2023-10-12 19:35
我知道两个引人入胜的项目:
posix for Java(基于JNI)[源自Jython]
jna-posix(基于JNA)[源自JRuby]
我个人非常喜欢JNA。看一下我的这个映射示例link(2)
:
import com.sun.jna.library;
import com.sun.jna.Native;
class Link {
private static final C c =
(C) Native.loadlibrary("c", C.class);
private static interface C extends library {
/** see man 2 link */
public int link(String oldpath, String newpath);
}
@Override
protected void hardLink(String from, String to) {
c.link(to, from);
}
}