Unsatisfied Link Errors with JNI program

Discussions regarding Open Source Java projects under z/OS (other than Tomcat)
Post Reply
pringle
Posts: 1
Joined: Mon Jan 22, 2018 5:25 pm

Unsatisfied Link Errors with JNI program

Post by pringle » Tue Jan 23, 2018 8:39 am

Hello,
I am getting the following error message when attempting to execute a JNI program on z/OS 2.3 with java 8:
Exception in thread "main" java.lang.UnsatisfiedLinkError: MyJniService.jniReq01()V

TestDriver:

public static void main(String[] args)
MyJniService jniService = new MyJniService();
jniService.jniReq01();

class MyJniService
{
public native void jniReq01();
static
{
System.out.println("MyJniService: Yes guys, i got here");
try
{
System.loadLibrary("FirstJni01");
}
catch(Exception e)
{
System.out.println( "MyJniService: ERROR: Unable to load Sample.so");
e.printStackTrace( );
}
System.out.println("MyJniService: Yes guys, i got here too");
}

Native C code:
#include <jni.h>
#include <stdlib.h>
#include "MyJniService.h"

JNIEXPORT void JNICALL Java_MyJniService_jniReq01
(JNIEnv *, jobject);

JNIEXPORT void JNICALL Java_MyJniService_jniReq01
(JNIEnv *env, jobject obj)
{
printf("Here in native code");
}

The link options used are:
-W "l,lp64,xplink,dll" -W "c,lp64,langlvl(extended),xplink,dll,exportall"
The libFirstJni01.so file was created successfully. Issuing nm on the .so file shows the correct external name.

Any ideas?
Thanks in advance.

Post Reply