Setting java.library.path property in java code

Hi,
i'd like to set java.library.path property in java code to load a dll-library. I know that a funtional way is to run JVM with parameter -Djava.library.path=c:\tmp, but I need it do it IN CODE.
I'v tried this:
System.setProperty("java.library.path", "c:\\tmp");
System.loadLibrary("libapr");The library 'libapr.dll' is situated really in 'c:\tmp' directory, but I get 'java.lang.UnsatisfiedLinkError: no libapr in java.library.path' exception.
It seems like the already running java program doesn't use actual java.library.path set in previous step.
Is there any possibility to set java.library.path property in java code?
Thanx
Brny

I think the following code should work:
// Reset the "sys_paths" field of the ClassLoader to null.
          Class clazz = ClassLoader.class;
          Field field = clazz.getDeclaredField("sys_paths");
          boolean accessible = field.isAccessible();
          if (!accessible)
               field.setAccessible(true);
          Object original = field.get(clazz);
          // Reset it to null so that whenever "System.loadLibrary" is called, it will be reconstructed with the changed value.
          field.set(clazz, null);
          try {
               // Change the value and load the library.
               System.setProperty("java.library.path", "c:\\tmp");
               System.loadLibrary("libapr");
          finally {
               //Revert back the changes.
               field.set(clazz, original);
               field.setAccessible(accessible);
The idea is to make the static field "sys_paths" null so that it would construct the paths from the changed value.

Similar Messages

  • How to add path to "java.library.path" property?

    I use this command to set the "java.library.path" property:
    java -Djava.library.path=./libs    HelloWorldBut it will overwrite the default value. How can I add the path "./libs" to the default value of "java.library.path"?

    Have you tried
    -Djava.library.path=%PATH%;./libs The command search path is the only default I know. By the way, are you certain that the present working directory will always be the parent of "libs"?

  • Java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path

    hi,
    i am trying to connect to an oracle 8.1.7 database from my application running on tomcat 4.0.3 / jdk1.4 /windows nt.
    using the thin jdbc-driver (classes12.zip) everything works fine.
    when i try using the oci8-driver, i get an error-message saying:
    java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path
    i have the oracle-client installed on my machine.
    the ocijdbc8.dll can be found in D:\server\oracla81\bin
    the environment-variables PATH, CLASSPATH, LD_LIBRARY_PATH (i'm not sure if this has any meaning on nt) all point to this directory.
    i start tomcat using the following option: -Djava.library.path="D:\server\oracla81\bin"
    my application can see this variable:
    System.out.println("java.library.path: "+System.getProperty("java.library.path"));
    prints out the correct value.
    then i try to load the library by myself:
    try {
    System.loadLibrary("ocijdbc8");
    System.out.println("Successfully Loaded");
    } catch(Exception e) {
    System.out.println("LD_LIBRARY_PATH is not properly set");
    e.printStackTrace();
    everything works fine! the library is loaded!
    finally i try to connect to the database and the application throws the mentioned exception:
    lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1410)
         at java.lang.Runtime.loadLibrary0(Runtime.java:772)
         at java.lang.System.loadLibrary(System.java:832)
         at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:228)
         at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:249)
         at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
    any help would be appreciated.
    thanx in advance,
    frank.
    [email protected]

    It is probably JDK 1.4 that causes the problem. I was able to get strange errors with that version of the JDK with code that worked fine using 1.31.

  • HELP: java.lang.UnsatisfiedLinkError: no ... in java.library.path

    am the beginner of JNI. I write a test program to use C code in JAVA.
    [yxz155@lionxo JAVAaC]$ ls
    AClassWithNativeMethods.java theNativeMethod.c
    [yxz155@lionxo JAVAaC]$ javac AClassWithNativeMethods.java
    [yxz155@lionxo JAVAaC]$ javah -jni AClassWithNativeMethods
    [yxz155@lionxo JAVAaC]$ ls
    AClassWithNativeMethods.class AClassWithNativeMethods.java
    AClassWithNativeMethods.h theNativeMethod.c
    [yxz155@lionxo JAVAaC]$ gcc -c -fPIC -I/usr/global/java/include -I/usr/global/java/include/linux theNativeMethod.c
    [yxz155@lionxo JAVAaC]$ ls
    AClassWithNativeMethods.class AClassWithNativeMethods.java theNativeMethod.o
    AClassWithNativeMethods.h theNativeMethod.c
    [yxz155@lionxo JAVAaC]$ ld -G theNativeMethod.o -o libJCI.so -lm -lc -lpthread
    [yxz155@lionxo JAVAaC]$ ls
    AClassWithNativeMethods.class AClassWithNativeMethods.java theNativeMethod.c
    AClassWithNativeMethods.h libJCI.so theNativeMethod.o
    [yxz155@lionxo JAVAaC]$ java AClassWithNativeMethods
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no CJI in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
    at java.lang.Runtime.loadLibrary0(Runtime.java:822)
    at java.lang.System.loadLibrary(System.java:992)
    at AClassWithNativeMethods.<clinit>(AClassWithNativeMethods.java:9)
    [yxz155@lionxo JAVAaC]$
    The codes are as follows, I tried setProperty() as in java program, but it did not work. I also tried set LD_LIBRARY_PATH and it did not work either.
    //AClassWithNativeMethods.java
    import java.io.File;
    import java.lang.System;
    public class AClassWithNativeMethods{
    public native void theNativeMethod();
    static {
    //System.setProperty("java.library.path",System.getProperty("java.library.path")+ File.pathSeparator+"/home2/yxz155/JAVAaC");
    //System.out.println(System.getProperty("java.library.path"));
    System.loadLibrary("CJI");
    public static void main(String[] args){
    AClassWithNativeMethods test = new AClassWithNativeMethods ();
    test.theNativeMethod();
    // theNativeMethod.c
    #include <stdio.h>
    #include "AClassWithNativeMethods.h"
    JNIEXPORT void JNICALL Java_AClassWithNativeMethods_theNativeMethod
    (JNIEnv *env, jobject obj){
    printf("Hello~~~~");
    //AClassWithNativeMethods.h
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class AClassWithNativeMethods */
    #ifndef IncludedAClassWithNativeMethods
    #define IncludedAClassWithNativeMethods
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: AClassWithNativeMethods
    * Method: theNativeMethod
    * Signature: ()V
    JNIEXPORT void JNICALL Java_AClassWithNativeMethods_theNativeMethod
    (JNIEnv *, jobject);
    #ifdef __cplusplus
    #endif
    #endif

    Hi all,
    I am getting the error in jdk 5:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: getObjectSize0
    at sun.instrument.InstrumentationImpl.getObjectSize0(Native Method)
    at sun.instrument.InstrumentationImpl.getObjectSize(InstrumentationImpl.java:97)
    at ObjectSizeEstimator.main(ObjectSizeEstimator.java:25)
    while executing the following code:
    public class ObjectSizeEstimator {
    static {
    System.loadLibrary("instrument");
    public static void main(String[] args) throws Exception {
    Constructor ctor = InstrumentationImpl.class
    .getDeclaredConstructor(new Class[] { long.class, boolean.class });
    ctor.setAccessible(true);
    Instrumentation inst = (Instrumentation) ctor.newInstance(new Object[] {
    Long.valueOf(0L), Boolean.TRUE });
    System.out.println(inst.getObjectSize(new Object()));
    "getObjectSize0" is the native method. All of my classpath setting is in place. Can Anybody tell me why i am getting this error.
    Thanks in advance....:)

  • What is the Java Library Path?

    Hi,
    I have a Java package that I need to add to my computer. The instillation information that I received with this package is as follows:
    * For this package to function, you must modify your java library path
    (the "java.library.path" property) or you must copy <WInterface.dll> to
    a directory that is already on that path.
    My questions are
    1). What is the java.library.path?
    2). How do I determine what the path is for my computer,
    3). And finally how do I modify this path?
    Thanks for your assistance.

    1) It is the list of paths to search when loading libraries.
    2) That can be found out with this program:public class PrintLibraryPath {
        public static void main(String[] args) {
            System.out.println(System.getProperty("java.library.path"));
    }3) By giving the java launcher the command line argument "-Djava.library.path=yourpath".

  • No ocijdbc10 in java.library.path

    Hello,
    I am using suse 9.3
    I installed http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html.
    Steps:
    1. copy files to /opt/oracle/client
    2. insert /opt/oracle/client into /etc/ld.so.conf
    3. copy tnsnames.ora into /opt/oracle/client
    3. export TNS_ADMIN=/opt/oracle/client
    then I try to write simple java aplication:
    package oracletest;
    import java.sql.SQLException;
    import oracle.jdbc.pool.*;
    import oracle.jdbc.oci.*;
    * @author hlavki
    public class Main {
         /** Creates a new instance of Main */
         public Main() {
          * @param args the command line arguments
         public static void main(String[] args) {
              try {
                   new OracleOCIConnectionPool
                        ("username", "*****", "jdbc:oracle:oci:@(description=(address=(host=10.0.0.224)(protocol=tcp)(port=1521))(CONNECT_DATA = (SERVICE_NAME = RORA.world)(FAILOVER_MODE = (TYPE=SELECT)(METHOD=BASIC))))", null);
              } catch (SQLException e) {
                   System.out.println(e.getMessage());
              } catch (java.lang.UnsatisfiedLinkError e2) {
                   System.out.println(e2.getMessage());
    }I write from command line:
    java -cp ./OracleTest.jar:/opt/oracle/client/ojdbc14.jar oracletest.Maineverytime I get error: "no ocijdbc10 in java.library.path".
    I don't know where is problem...
    hlavki@homer:~/bordel/datastudio> l /opt/oracle/client
    celkom 101162
    drwxr-xr-x  4 root   root       576 2005-07-26 10:27 ./
    drwxr-xr-x  5 root   root       136 2005-07-26 10:05 ../
    drwxr-xr-x  2 root   root        72 2005-07-25 18:00 bin/
    -r--r--r--  1 root   root   1590491 2005-06-28 19:11 classes12.jar
    -r--r--r--  1 root   root      1525 2005-06-28 19:11 glogin.sql
    lrwxrwxrwx  1 root   root        17 2005-07-26 08:44 libclntsh.so -> libclntsh.so.10.1*
    -rwxrwxrwx  1 root   root  18505986 2005-06-28 19:11 libclntsh.so.10.1*
    -r-xr-xr-x  1 root   root     27702 2005-06-28 19:11 libheteroxa10.so*
    -r-xr-xr-x  1 root   root   5480533 2005-06-28 19:11 libnnz10.so*
    -rwxrwxrwx  1 root   root   1397960 2005-06-28 19:11 libocci.so.10.1*
    -rwxrwxrwx  1 root   root  70659429 2005-06-28 19:11 libociei.so*
    -r-xr-xr-x  1 root   root    119947 2005-06-28 19:11 libocijdbc10.so*
    -r-xr-xr-x  1 root   root   1434227 2005-06-28 19:11 libsqlplusic.so*
    -r-xr-xr-x  1 root   root   1047293 2005-06-28 19:11 libsqlplus.so*
    -r--r--r--  1 root   root   1536979 2005-06-28 19:11 ojdbc14.jar
    -r--r--r--  1 root   root   1642000 2005-06-28 19:11 orai18n.jar
    drwxrwxrwx  4 root   root       152 2005-06-28 19:11 sdk/
    -r-xr-xr-x  1 root   root      8843 2005-06-28 19:11 sqlplus*
    -rw-rw-r--  1 hlavki users      478 2005-07-26 10:12 tnsnames.orathanks, miso

    I am found the same error but my app server is in windows. What should I do?
    Exception
    Type:
    class java.lang.UnsatisfiedLinkError
    Message:no ocijdbc10 in java.library.path Stack trace:java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
         at java.lang.Runtime.loadLibrary0(Runtime.java:788)
         at java.lang.System.loadLibrary(System.java:834)
         at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:2855)
         at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:222)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:344)
         at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:136)
         at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:79)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
         at java.sql.DriverManager.getConnection(DriverManager.java:512)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at com.rap_x.setup.HibernateConfigurator.checkJdbcConnection(HibernateConfigurator.java:416)
         at com.rap_x.setup.controllers.DatabaseController.setupDB(DatabaseController.java:53)
         at com.rap_x.setup.controllers.AbstractDatabaseController.processFormSubmission(AbstractDatabaseController.java:77)
         at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:236)
         at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:119)
         at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
         at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:389)
         at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:342)
         at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:328)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:534)

  • How to set java.library.path form code

    I'm new to JNI. I see there are several ways to set JVM to look for libraries dll, so, etc.
         System.setProperty("java.library.path", ".");
         System.loadLibrary("hello");That's when UnsatisfiedLinkError
    java.lang.UnsatisfiedLinkError: no hello in java.library.path
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
         at java.lang.Runtime.loadLibrary0(Runtime.java:822)
         at java.lang.System.loadLibrary(System.java:992)
         at HelloWorld.main(HelloWorld.java:17)But if I comment the line that sets the java.library.path and call the program with the command java -Djava.library.path=. HelloWorld works.
    The question is: Why is not working? How should it be the property setup? I rather don't set Variables, or use -D option.
    Thanks in advance.
    PD: If it helps I'm using JDK 1.5.0_01 on Linux kernel 2.6.8

    well i wrote the script and everything is fine! i can run the blackbox example on the commapi.
    But i am writing another program using netbeans to send some data to a PIC microcontroller using the serial port (that is why i installed the commapi), and when i'm trying to build it or run it on netbeans throws this error:
    Error loading LinuxSerialParallel: java.lang.UnsatisfiedLinkError: no LinuxSerialParallel in java.library.path
    Exception in thread "main" java.lang.UnsatisfiedLinkError: isDevLink
    at com.sun.comm.Unix.isDevLink(Native Method)
    at com.sun.comm.PathBundle.add(PathBundle.java:108)
    at com.sun.comm.PlatformPortBundle.<init>(PlatformPortBundle.java:44)
    at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:138)
    as far as i know it seems to be missing a library (LinuxSerialParallel), if this is right, adding the library would solve the error?how can i add the library? is there another way to solve this?
    thanks in advance!!

  • LoadLibrary doesn't use java.library.path set at runtime

    I'm trying to set the property java.library.path at runtime so I don't have to drop my .dll in the regular system path for a System.loadLibrary to work. This is the sequence I use in a static initilizer:
    System.setProperty("java.library.path", "C:\\");
    System.loadLibrary("DialButton");
    When I put the file DialButton.dll in C:\ I get an java.lang.UnsatisfiedLinkError, but when I put it in D:\WINNT it works fine. I would expect it to do the opposite because presumably I blew away the real java.library.path when I ran setProperty and it shouldn't know to check D:\WINNT.
    I'm trying to keep my application install clean and use a directory structure that maintains all of the required files without cluttering system directories. I also want to dynamically load JNI libraries for a distributed application after copying them to the local machine.
    Thanks in advance,
    Ryan

    In the bug parade I've heard excuses from Sun programmers that this is a read-only property and isn't supposed to be changed. It probably took them longer to write the reply to the bug than it would have to fix the code.
    I looked at the source code for the ClassLoader and for the source release of the JDK 1.3.1 and here's the code I found in the ClassLoader.loadLibrary() method:
            if (sys_paths == null) {
                    usr_paths = initializePath("java.library.path");
                    sys_paths = initializePath("sun.boot.library.path");
            }It seems it parses and caches the system and user library paths on startup and then never bothers to check them to see if they've changed ever again. I think it would be pretty simple to rewrite that code block by moving one line of code down two lines as this:
            if (sys_paths == null) {
                    sys_paths = initializePath("sun.boot.library.path");
            usr_paths = initializePath("java.library.path");I mean, it's not as if loadLibrary is really performance intensive or even critical enough to bother caching at all!
    This one code change could fix a lot of headaches.
    The particular headache I'm working on is that there doesn't seem to be any support in the Servlet 2.2 or 2.3 specification for JNI files. I'd really love to be able to use a directory like WEB-INF\jni to store libraries that need to be distributed with my web application. I tried to dynamically change java.library.path to include WEB-INF\jni, but alas I ran into the same problem you did, it doesn't work.
    Is is possible for this to be fixed, ever? I think it would take longer to say no and make up a reason why not then it would to actually make the fix... seems a good enough arguement to do it to me.
    And alternately, can we come up with a standard place to put JNI stuff for web applications in the next Servlet standards?
    Thanks in advance!
    -J.C.
    [email protected]

  • How the java.library.path is set?

    Hi,
    Can anyone please tell me know how System class (or JVM) sets the default value of the property java.library.path?
    I tried searching the answer on net but I was not able to find any thing.
    Regards,
    Kev.

    If you don't set it, I believe the JVM then reverts to using the search strategy of the native system.
    On Windows, that means first looking in load directory, then looking in the Windows directory. (I made this intentionally vague; I believe these actually changed at one point during Windows' history.)
    It is something else on Unices.

  • Still got java.lang.UnsatisfiedLinkError even after I set java.library.path

    Hi,
    I developed a Java application which uses JNI. Before I run the application, I set an environment variable JAVA_LIBRARY_PATH to where I put the .dll file required by my application. But when I try to run the application, I always get the exception of "java.lang.UnsatisfiedLinkError " saying that no the required .dll in java.library.path. Could anyone please tell me what's going on there ?(I am using JDK1.5.0_05.)
    thanks !

    Hi Scott,
    Thanks for your help !
    I also tried setting PATH before. But with this setting I got another problem that if I tried to the application the second time or more times, it always gives me an exception saying that the dll library already loaded by another loader. That's why I moved to set JAVA_LIBRARY_PATH because this way ever worked for me when I used lower version of Java. I did not use -Djava.library.path= option because I want to invoke my application from web application which may use RMI or HTTP.

  • Does JVM variable java.library.path make sense from native code?

    Hello all,
    Well, everybody loads native library from the Java side by calling System.loadLibrary("myNative").
    But what if, for example, myNative.dll loads another two libraries itself?
    Suppose, when I call java method "initMyNative", it in turn call native function Java_initMyNative(...). That Java_initMyNative(...) wants to load two native libraries and make: HINSTANCE lib01 = LoadLibrary("auxlib01.dll");  // LoadLibrary from capital, it's Win function!
    HINSTANCE lib02 = LoadLibrary("auxlib02.dll");  // LoadLibrary from capital, it's Win function!As specified, native LoadLibrary call will look for auxlib01.dll and auxlib02.dll in catalogs which are enumerated in system variable PATH, current catalog.
    Does java.library.path make any sense on order of such search?
    If not, is there any way of flexible configuring of the catalog in which to look auxlib01.dll and auxlib02.dll for?
    I see some ways:
    * changing system variable PATH - not flexible
    * passing content of java.library.path into native code, parsing it and looking for auxlib01.dll and auxlib02.dll in each catalog listed in java.library.path - too heavy
    I hope there is more smart way to do that.
    Thanks, Alex

    Thank you Shane for your reply. I actually didnt have to create 2 jar files, one for Java files and one for the dll file. I got an idea from your post and referenced the same jar file twice by saying:
    <j2se version="1.2+" />
    <jar href="HelloWorld.jar"/>
    <nativelib href="HelloWorld.jar"></nativelib>
    and by saying that the jnlp file started working from the browser.
    Again, thanks a lot for your replies.
    Thanks
    Nick

  • Error with System.loadLibrary(...) with java.library.path set

    I'm trying to get my feet wet with JavaMonkeyEngine using netbeans (on Windows XP SP3, Java 1.6).
    When I try to run a simple example program, I'm getting
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl.dll in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
    My runtime arguments include: -Djava.library.path="../../../../../projectSupport/jME2/lib/lib/lwjgl/native/windows/:etc
    I'm pretty sure that the path is correct, because I tried the following code:
    String [] dirs = System.getProperties().getProperty("java.library.path").split(":");
    for(int i = 0; i < dirs.length; i++ ){
    String path = dirs[i] + java.io.File.separatorChar + "lwjgl.dll";
    if( (new java.io.File(path)).exists()) {
    System.out.println("found in dir " + dirs);
    path = (new java.io.File(path)).getAbsolutePath();
    System.load(path);
    System.out.println("was able to load library manually");
    and the System.load method was reached and didn't throw an exception.
    However, the below call does throw an exception.
    System.loadLibrary("lwjgl.dll");
    Presumably, I shouldn't need to put the dlls into my Path (otherwise whats the purpose of the -D argument).
    I would appreciate some brilliant illuminating thought about now, something like "you forgot the magical snafu parameter" or such.
    Thanks in advance.
    Eric.

    My runtime arguments include:
    -Djava.library.path="../../../../../projectSupport/jME2/lib/lib/lwjgl/native/windows/:{code}So, you're on a Windows OS, and looking for a Windows DLL?
    I'm pretty sure that the path is correct, because I tried the following code:
    {code}String [] dirs = System.getProperties().getProperty("java.library.path").split(":");{code}So, you're specifying a path using the UNIX separator ':', instead of the Windows one ';'?
    Your test code has the knowledge to parse a LINUX-like path, but the Windows VM doesn't have this knowledge (I admit the misleading part is that the VM generally accepts '/' as a file separator (instead of the Windows-standard '\' one), but doesn't recognize the ':' separator). Try using ';' to separate multiple pathes in your command line:
    {code}-Djava.library.path="../../../../../projectSupport/jME2/lib/lib/lwjgl/native/windows/;<noticeTheSeparators>;...    J.
    Edited by: jduprez on Jan 12, 2010 1:39 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • No jacob in java.library.path.doc

    I am running Developer Suite 10g on Windows XP. I have the OC4J instance running. I am using WebUtil and trying to use the OLE2 stuff. When I execute the code, nothing happens (see errors below) – except all my buttons go dead. I checked, and it does not seem that I am getting the Jacob, JNIsharedstubs, and the d2kwut60 DLLs to download to my Jinitiator directory. I removed and reinstalled Jinitiator, but still nothing. If I manually copy the DLLs to the directory, I at least begin to get OLE2 errors. I read the message board (and modified “Word.Basic” to “Word.Application”) and read the WebUtil manual and reviewed my set-up. Any suggestions are much appreciated.
    Java console:
    Oracle JInitiator: Version 1.3.1.17
    Using JRE version 1.3.1.17-internal Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\don4
    Proxy Configuration: Automatic Proxy Configuration
    JAR cache enabled
    Location: C:\Documents and Settings\don4\Oracle Jar Cache
    Maximum size: 50 MB
    Compression level: 0
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    Downloading http://d26.corp.don.com:8889/forms90/java/f90all_jinit.jar to JAR cache
    Downloading http://d26.corp.don.com:8889/forms90/webutil/webutil.jar to JAR cache
    RegisterWebUtil - Loading Webutil Version 1.0.2 Beta
    Downloading http://d26.corp.don.com:8889/forms90/webutil/jacob.jar to JAR cache
    proxyHost=null
    proxyPort=0
    connectMode=HTTP, native.
    Forms Applet version is : 9.0.4.0
    2004-Jun-18 14:33:28.903 WUI[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2004-Jun-18 14:33:28.953 WUF[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2004-Jun-18 14:33:28.983 WUH[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2004-Jun-18 14:33:29.13 WUS[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2004-Jun-18 14:33:29.53 WUT[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2004-Jun-18 14:33:29.214 WUO[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2004-Jun-18 14:33:29.254 WUL[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2004-Jun-18 14:33:29.284 WUB[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2004-Jun-18 14:33:34.745 WUT[setProperty()] Setting property WUC_GET_LOCAL_PROPERTY to syslib.jacob.dll
    2004-Jun-18 14:33:34.785 WUT[getProperty()] Getting property WUC_GET_LOCAL_PROPERTY
    2004-Jun-18 14:33:34.815 WUT[loadSettings()] Local properties file loaded
    2004-Jun-18 14:33:34.855 WUT[setProperty()] Setting property WUC_GET_LOCAL_PROPERTY to syslib.JNIsharedstubs.dll
    2004-Jun-18 14:33:34.895 WUT[getProperty()] Getting property WUC_GET_LOCAL_PROPERTY
    2004-Jun-18 14:33:34.926 WUT[setProperty()] Setting property WUC_GET_LOCAL_PROPERTY to syslib.d2kwut60.dll
    2004-Jun-18 14:33:34.976 WUT[getProperty()] Getting property WUC_GET_LOCAL_PROPERTY
    2004-Jun-18 14:33:49.722 WUF[setProperty()] Setting property WUF_FILENAME to C:\temp
    2004-Jun-18 14:33:49.722 WUF[setProperty()] Setting property WUF_FILE_ATTRIBUTE to 1
    2004-Jun-18 14:33:49.722 WUF[getProperty()] Getting property WUF_FILE_ATTRIBUTE
    2004-Jun-18 14:33:49.742 WUF[setProperty()] Setting property WUF_FILENAME to C:\temp
    2004-Jun-18 14:33:49.742 WUF[setProperty()] Setting property WUF_FILE_ATTRIBUTE to 4
    2004-Jun-18 14:33:49.742 WUF[getProperty()] Getting property WUF_FILE_ATTRIBUTE
    2004-Jun-18 14:33:49.752 WUF[setProperty()] Setting property WUF_GFN_DIRNAME to C:\temp
    2004-Jun-18 14:33:49.772 WUF[setProperty()] Setting property WUF_FILENAME to *.csv
    2004-Jun-18 14:33:49.772 WUF[setProperty()] Setting property WUF_FILTER to All CSV Files (*.csv)|*.csv|
    2004-Jun-18 14:33:49.792 WUF[setProperty()] Setting property WUF_GFN_MESSAGE to Open Interface Import File
    2004-Jun-18 14:33:49.822 WUF[setProperty()] Setting property WUF_GFN_MULTISELECT to FALSE
    2004-Jun-18 14:33:49.822 WUF[getProperty()] Getting property WUF_GFN_OPENFILE
    2004-Jun-18 14:33:52.904 WUF[setProperty()] Setting property WUF_FILENAME to false
    2004-Jun-18 14:33:52.904 WUF[setProperty()] Setting property WUF_FILE_ATTRIBUTE to 4
    2004-Jun-18 14:33:52.904 WUF[getProperty()] Getting property WUF_FILE_ATTRIBUTE
    2004-Jun-18 14:33:52.914 WUF[setProperty()] Setting property WUF_FILENAME to false
    2004-Jun-18 14:33:52.914 WUF[setProperty()] Setting property WUF_FILE_ATTRIBUTE to 1
    2004-Jun-18 14:33:52.914 WUF[getProperty()] Getting property WUF_FILE_ATTRIBUTE
    2004-Jun-18 14:33:52.924 WUF[setProperty()] Setting property WUF_FILENAME to false
    2004-Jun-18 14:33:52.924 WUF[setProperty()] Setting property WUF_FILE_ATTRIBUTE to 2
    2004-Jun-18 14:33:52.934 WUF[getProperty()] Getting property WUF_FILE_ATTRIBUTE
    2004-Jun-18 14:34:00.212 WUO[setProperty()] Setting property WUO_OLE2_OBJNAME to WORD.Basic
    2004-Jun-18 14:34:00.222 WUO[getProperty()] Getting property WUO_OLE2_CREATE_OBJ
    Exception occurred during event dispatching:
    java.lang.UnsatisfiedLinkError: no jacob in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at com.jacob.com.Dispatch.<clinit>(Dispatch.java)
    at oracle.forms.webutil.ole.OleFunctions.create_obj(OleFunctions.java:513)
    at oracle.forms.webutil.ole.OleFunctions.getProperty(OleFunctions.java:218)
    at oracle.forms.handler.UICommon.onGet(Unknown Source)
    at oracle.forms.engine.Runform.onGetHandler(Unknown Source)
    at oracle.forms.engine.Runform.processMessage(Unknown Source)
    at oracle.forms.engine.Runform.processSet(Unknown Source)
    at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
    at oracle.forms.engine.Runform.onMessage(Unknown Source)
    at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
    at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
    at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    J:\WebUtil\server\WebUtil.cfg file contains:
    install.syslib.location=http://d26.corp.don.com:8889/forms90/webutil
    install.syslib.0.7.1=jacob.dll|94208|1.0|true
    install.syslib.0.9.1=JNIsharedstubs.dll|65582|1.0|true
    install.syslib.0.9.2=d2kwut60.dll|192512|1.0|true
    C:\Oracle\10iDS2\forms90\server\default.env contains:
    ORACLE_HOME=c:\oracle\10iDS2
    FORMS90_PATH=c:\oracle\10iDS2\cgenf61\admin;c:\oracle\10iDS2\forms90;c:\ipms\forms10g;j:\WebUtil\forms;j:\WebUtil\lib;j:\bin10g
    PATH=c:\oracle\10iDS2\bin;c:\oracle\10iDS2\jdk\jre\bin\client
    FORMS90=c:\oracle\10iDS2\forms90
    WEBUTIL_CONFIG=j:\webutil\server\webutil.cfg
    CLASSPATH=j:\webutil\lib\webutil.jar;j:\webutil\lib\jacob.jar;c:\oracle\10iDS2\jdk\jre\lib\rt.jar;c:\oracle\10iDS2\j2ee\forms90app\forms90web\WEB-INF\lib\f90srv.jar;c:\oracle\10iDS2\jlib\repository.jar;c:\oracle\10iDS2\jlib\ldapjclnt9.jar;c:\oracle\10iDS2\jlib\debugger.jar;c:\oracle\10iDS2\jlib\ewt3.jar;c:\oracle\10iDS2\jlib\share.jar;c:\oracle\10iDS2\jlib\utj90.jar;c:\oracle\10iDS2\jlib\zrclient.jar;c:\oracle\10iDS2\reports\jlib\rwrun.jar;C:\Oracle\10iDS2\jdk\jre\bin\client\jvm.dll
    Orion-web.xml contains:
    <virtual-directory virtual-path="/webutil" real-path="j:\webutil\lib" />
    Forms90.conf contains:
    # Virtual path for webutil
    AliasMatch ^/forms90/webutil/(..*) "j:\webutil\lib/$1"
    Formsweb.cfg has all changes in one named section:
    [webutil]
    pageTitle=Oracle9iAS Forms Services - WebUtil
    webUtilArchive=/forms90/webutil/webutil.jar,/forms90/webutil/jacob.jar
    WebUtilLogging=all
    WebUtilLoggingDetail=detail
    WebUtilErrorMode=Alert
    baseHTMLjinitiator=j:\webutil\server\webutiljini.htm

    >
    Orion-web.xml contains:
    <virtual-directory virtual-path="/webutil"
    real-path="j:\webutil\lib" />
    Forms90.conf contains:
    # Virtual path for webutil
    AliasMatch ^/forms90/webutil/(..*)
    "j:\webutil\lib/$1"
    I'm not sure about 10G, but for 9ids this is definitely wrong (see famous page 6 of 49 WebUtil Manual). On 9ids you have to add the virtual directory in orion-web.xml only, not in forms90.conf. On 9ias it is vice verca.
    Hope this helps
    Gerald

  • Oracle Calendar - UnsatisfiedLinkError: no csdkjni in java.library.path

    Hi, all.
    I deployed my test calendar application developed using Jdeveloper 10.1.3.0 (on Windows XP) to the Oracle 10.1.3. AS on a linux server, but the CalendarServer in on another installation (Collaboration Suite 10.1.2) on the same linux server.
    When I try to executed the code that calls the calendar server I get this error:
    500 Internal Server Error
    javax.faces.el.EvaluationException: java.lang.UnsatisfiedLinkError: no csdkjni in java.library.path
    I set the LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME/ocal/lib on the collaboration suite 10.1.2 installation.
    When I try to run the code on my Jdeveloper I get the same error:
    java.lang.UnsatisfiedLinkError: no csdkjni in java.library.path
    In my windows machine I create a folder where I put the dll's and jar files that came from the collaboration suite windows installation, but I get always the same error
    This is the code:
    try
    Api.init("calendar.ini", "calendar.log");
    catch(Api.StatusException e)
    System.out.println("init returned status'" + e.getMessage() + "'");
    System.exit (1);
    Is my approach correct? Because if i'm developing on Windows and I need dll's files to connect to the calendar server on linux, but when I deploy the application to the linux server those dll's are useless and cannot be used. So am I missing something here? Do I need anything else to get this to work?
    Best Regards,
    Rui

    1. Use 1 and only 1 of classes12.zip and ojbc14.jar; they have different versions of the same classes in them.
    2. The Oracle OCI driver for JDBC uses .dll files or .so files from the Oracle client installation (as well as Oracle network configuration files, I think); most people use the thin driver instead to avoid this problem.
    To use the thin driver, change your url, see here for details:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#05_00
    To stay with the OCI driver (not recommended), you need to have the appropriate Oracle client installation (or at least get the dlls or sos), and I think set additional environment variables, such as ORACLE_HOME and possibly LD_LIBRARY_PATH. I don't do this myself, so I can't give much more advice.

  • UnsatisfiedLinkError: no something in Java.library.path

    Hi everybody,
    This error seem to be common with many ppl, but i couldnt solve it after go through couple of available solutions. My java program using native C++ code to control the hardware input like mouse click or keyboard under Linux. I've also used jdic for system tray. So basislly i have some external jar files and .so shared-files. When i ran the project, i got this error. I have tried to add the missing .jar file to project external jar file and the required library files in the java.library.path using add variables in project setting. It doesnt work
    Can anybody have some advices, thank you?

    Hi,
    Please check out this thread http://forums.sun.com/thread.jspa?threadID=627890

Maybe you are looking for