Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2011
What would you like to do?
Java class to kill the current process using JNA
/* Requires JNA
* Get jna.jar here:
import com.sun.jna.Library;
import com.sun.jna.Native;
public class SelfKiller
private interface CLibrary extends Library
CLibrary INSTANCE = (CLibrary) Native.loadLibrary("c", CLibrary.class);
int getpid ();
void kill(int pid, int signal);
public static void killSelf()
int pid = CLibrary.INSTANCE.getpid();
CLibrary.INSTANCE.kill(pid, 9);
public static void main(String[] args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment