0
此问题可能与this以及其他一些UnsatisfiedLinkError问题有关。JNR UnsatisfiedLinkError
我试图运行下面的代码。
import jnr.ffi.LibraryLoader;
import jnr.ffi.types.pid_t;
/**
* Gets the process ID of the current process, and that of its parent.
*/
public class Getpid {
public interface LibC {
public @pid_t long getpid();
public @pid_t long getppid();
}
public static void main(String[] args) {
LibC libc = (LibC) LibraryLoader.create(LibC.class).load("c");
System.out.println("pid=" + libc.getpid() + " parent pid=" + libc.getppid());
}
}
代码编译正确,但拒绝运行,
(编译步骤)
javac -cp /usr/share/java/jnr-ffi.jar:. Getpid.java
(运行步骤)
java -cp /usr/share/java/jnr-ffi.jar:. Getpid
在运行,我得到THI s error。
它无法找到所请求的类。查看堆栈跟踪底部的根本原因 – Dummy
谢谢,这有帮助! –