Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JNI problem on SCO OpenServer 5.0.2 (UnsatisifiedLinkError)

2 views
Skip to first unread message

Paul Gammon

unread,
Jan 6, 1998, 3:00:00 AM1/6/98
to

Hello

Can anyone help with the following problem ?

I'm currently trying to get a simple JNI example from
'The Java Tutorial' to work on SCO OpenServer 5.0.2 but can't get
around a runtime link problem. The following error message is
being generated when I invoke the Java application.

object: /u/prcg/work/WWW/java/jni/libhello.so
(libhello.so)
java.lang.UnsatisfiedLinkError: no hello in shared library path
at java.lang.Runtime.loadLibrary(Runtime.java)
at java.lang.System.loadLibrary(System.java)
at
at java.lang.Thread.init(Thread.java)


The Java application consists of the two files. Main.java ...

class Main {

static public void main( String args[] ) {
new HelloWorld().displayHelloWorld();
}
}


... and HelloWorld.java ...

class HelloWorld {

public native void displayHelloWorld();

static {
System.loadLibrary( "hello" );
}
}


The dynamic link library is generated from the C file hello.c ...

#include <stdlib.h>
#include <stdio.h>
#include <jni.h>
#include "HelloWorld.h"

JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld( JNIEnv *
env, jobject obj )
{
printf( "hello()\n" );
}

... a header file generated by the javah utility and the makefile ...

INCPATH = -I/opt/jdk-1.1/include -I/opt/jdk-1.1/include/unixware

CCFLAGS = -g $(INCPATH) -dy -K PIC
LDFLAGS = -dy -G $(LIBPATH)

libhello.so: hello.o
/usr/ccs/bin/elf/ld $(LDFLAGS) -o $@ $(OBJS)

.c.o:
cc $(CCFLAGS) -c $<

I am using version 1.1.1 of the JDK and the LD_LIBRARY_PATH variable is
set
correctly. To confirm that the library works I have written a simple
program
that managed to invoke the single public function in the library.

Thanks in advance for any responses.

Paul Gammon

0 new messages