<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.5.2</version>
</dependency>
package bj;
import com.sun.jna.Library;
import com.sun.jna.Native;
import java.lang.management.ManagementFactory;
class App {
public static void main(String[] var0) {
System.out.println(ManagementFactory.getRuntimeMXBean().getName().split("@")[0]);
System.out.println(Native.loadLibrary("c", TheCLibrary.class).getpid());
Native.loadLibrary("c", TheCLibrary.class).printf("%016x", 4095);
}
}
interface TheCLibrary extends Library {
int getpid();
void printf(String format, Object... args);
}
18724
18724
0000000000000fff