Posix for Java
by Stuart D. Gathman
Last updated Sep 28, 2009
Why Posix for Java?
A frequently asked question on Java newsgroups is "How do I use unix
signals (or messages or environment variables or ...) in Java?" The answer
is, you can't with standard Java. Equivalent features are in Java. For
example, Properties instead of environment variables or Sockets instead
of the various forms of unix IPC.
However, sometimes it is necessary to interface with code written for
the unix environment - and that code can't be rewritten to use Sockets.
In those cases, it would be nice to have simple access to the Posix API
without everyone having to reinvent the wheel.
One solution is the posix
package. This package provides
access to the posix API from Java. It uses a JNI library which should
be portable to other posix systems. I started this package with the
intent of making it reusable by others. However, it only has the classes
I have needed for my own projects at present :-). I am making the source
and docs public so that others can reuse what I have so far and so that
I can collect any additions added by others.
There is another posix API for Java used by the
Jython project:
jnios.
I will be looking at incorporating features from that package, or
getting rid of my own entirely. I will not get rid of 'posix' if the
jnios package requires jython.
Please see the javadocs for further information.
Here is the current source as a directory for your inspection.
Send comments to
Stuart D. Gathman.