Is there a Java library of Unix functions? Is there a Java library of Unix functions? unix unix

Is there a Java library of Unix functions?


I'm aware of two compelling projects:

Personally I like very much JNA. Take a look at this example of mine, mapping 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);    }}


JNA-POSIX is stagnant currently, as far as I know.

The developers went on to create JNR-POSIX


I would be surprised to see one, considering it would almost necessarily be platform-specific. Java is not the best tool for that job. But you could certainly hook in via JNI or calls out to external programs if you insist. Or perhaps look into Groovy, which I understand is reasonably good for shell scripting, though I have no personal experience with it.