• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do you set a library path in java ?  RSS feed

 
Keshini Weerasuriya
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey... I get the error message...

java.lang.UnsatisfiedLinkError: nativeLoadProlog
at Int386w.nativeLoadProlog(Native Method)
at Int386w.loadProlog(INT386w.java:28)
at FlexIS.loadFlex(FlexIS.java:21)
at FlexEG.<init>(FlexEG.java:30)
at FlexEG.main(FlexEG.java:18)

How do you set a library path in java??
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't set it in java, but in the OS.
On linux:
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's one way -- works on UNIX variants only. You can also put the libraries on the PATH (works for Windows only). Or you can do things the portable way, and use the special system property for this: it's java.library.path, as in

java -Djava.library.path=c:\wherever Foo

Now, "Kesh", you need to check out our policy on display names, and adjust your accordingly by visiting this page. Thank you kindly!
 
Keshini Weerasuriya
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi... Thanks for your help.. I'm trying to connect flex (expert system shell) with java..

Even though i set the library path it still doesn't seem to work..........
Can u suggest any other way?? why do i keep on getting the same error??
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java.library.path thing does work fine, as does LD_LIBRARY_PATH on Unix-like platforms. If your program isn't working, then you need to look carefully at what files are where etc. and to read the JNI documentation carefully.

There are other ways to connect Java native methods to their underlying native implementations. Your native code can load the library itself explicitly, using platform-specific code (e.g. LoadLibrary() on Windows). It can then use the JNI RegisterNatives() function to link functions in the library to Java native methods. This also frees you from naming the native functions according to the rather long-winded JNI function names.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:
Or you can do things the portable way, and use the special system property for this: it's java.library.path, as in

java -Djava.library.path=c:\wherever Foo

c: - very portable, indeed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!