Search code examples
javareal-time-java

UnsatisfiedLinkError when trying to run Real time Java code on Websphere Real Time JVM on Linux


I'm trying to run real time java code using the Websphere Realtime Java VM on Ubuntu Linux 32 bit. I could get the code to build, but for some reason the VM is unable to locate the native libraries that implement the javax.realtime classes and throws an UnsatisfiedLinkError. Any ideas on how to fix this will be appreciated.

import javax.realtime.*;
public class HelloRTWorld {

public static void main(String[] args) {
    RealtimeThread rt = new RealtimeThread() {
        public void run() {
            System.out.println("Hello RT World");
        }
    };
    rt.start();
}   
}

This is the error trace:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: javax/realtime/RealtimeThread.putAsyncHandlerClassToThread(Ljava/lang/Class;)V
at javax.realtime.RealtimeThread.<clinit>(RealtimeThread.java:122)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:233)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at net.suhrid.HelloWorld.main(HelloWorld.java:9)

Solution

  • You don't need to put any jars on the command-line specifically, but you do need to run with -Xrealtime to activate real-time support.

    You may also have trouble with the Ubuntu kernel not providing sufficient real-time performance (so WRT could fail to start with this option). The supported real-time operating systems are Red Hat's MRG and Novell SLERT.