Page 1 of 1

Unsatisfied Link Errors with JNI program

Posted: Tue Jan 23, 2018 8:39 am
by pringle
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


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

class MyJniService
public native void jniReq01();
System.out.println("MyJniService: Yes guys, i got here");
catch(Exception e)
System.out.println( "MyJniService: ERROR: Unable to load");
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 file was created successfully. Issuing nm on the .so file shows the correct external name.

Any ideas?
Thanks in advance.