I ran into this same problem working on TclBlend (Java access in Tcl).
To fix things you will need to set some env vars so that the required
libs are preloaded (loaded before your JNI process is started).

(if you are using Lesstif)
LD_PRELOAD=libXt.so libXm.so libXext.so
LD_BIND_NOW=1

(if you are using Motif)
TCLBLEND_LD_PRELOAD="libXm.so libXpm.so libXt.so libSM.so libICE.so
libXext.so libX11.so"
LD_BIND_NOW=1

With those vars set you should be able to run with both JDK1.1 and JDK1.2
from blackdown. You would not need to do this under other systems like
Solaris as they link to Motif. The blackdown port compiles motif
statically into the java executable so there is no way to access the
motif code shipped by blackdown using JNI.

I hope that helps
Mo DeJong
dejong at cs.umn.edu

On Mon, 3 May 1999, Bernd Kreimeier wrote:

> 
> hal:/opt/local/java/jdk/lib/i586/native_threads# 
> ldd ./libawt.so 
>   libpthread.so.0 => /lib/libpthread.so.0 (0x4004a000)
>   libc.so.6 => /lib/libc.so.6 (0x40057000)
>   /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
> nm -D ./libawt.so | grep XtShellStrings
>   U XtShellStrings
> 
> nm -D libXt.so.6.0 | grep XtShellStrings
>   00041c2c R XtShellStrings  
>     (aside: what manpage/info covers symbol flags...)
>  
> My invocation test:
>  invoking VM next...
>  returns JNIEnv 0x40075304
>  Loaded Test.class
>  Retrieved methodID for Test.init()V
>  JAVA: Test.init()V called.
>  /opt/local/java/jdk/lib/i586/jthreads/libawt.so: 
>    undefined symbol: XtShellStrings (libawt.so)
> 
> The same test class works fine with "java Test" (popping up
> the AWT Frame, that is), but with invocation, this doesn't
> work, as libawt.so is not loaded. What am I missing here?
> Shouldn't the "ldd libawt.so" list each any any X, JPEG,
> GIF etc. dependency to make sure that in loading it, all
> symbols are resolved?
> 
> Is there a workaround? Link my own bogus libawt.so?
>  
> Suggestion: add a few plain JNI Invocation tests linked 
> only with -ljava to your test suite? If you'd load AWT,
> java.net, java.io and other core packages with native
> code dependencies, this should catch any such omissions.
> 
> 
>                                                 b.
> 
> 
> P.S.: I actually tried System.loadLibrary("Xt"), which
> passes w/o any error (probably doing nothing).
> 
> 
> 
> public class Test {
>   /**
>    * The init() method visible to native code.
>    * All mayhem starts here.
>    */
>   public static final void init() {
>     System.out.print("JAVA: Test.init()V called.\n");
>     TestApplet app = new TestApplet();
>   
>     // Frame for the applet.
>     Frame frame = new Frame( "JAVA: " + app.getClass().getName() );
>     frame.add("Center", app);
>     frame.resize(WIDTH,HEIGHT);
>     frame.show();
>     
>     // Start the applet.
>     app.init();
>     app.start();
>  
>     ...   
>   }
> 
>   ...
> 
> }
> 
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to