Steve Sperber
asked on
java.lang.UnsatisfiedLinkError: (A file or directory in the path name does not exist)
Tried a few examples on AIX box and everytime I get the error as below:-
Calling C code from Java using JNI
The "libctest.so" is very much in the path and LD_LIBRARY_PATH.
On running below command.
export LD_LIBRARY_PATH=.
I get.
Below tutorial gives similar issue
Calling C From Java Is Easy
I am not sure what is going wrong
Calling C code from Java using JNI
java HelloWorld
The java class could not be loaded. java.lang.UnsatisfiedLinkError: ctest (Not found in java.library.path)
The "libctest.so" is very much in the path and LD_LIBRARY_PATH.
On running below command.
export LD_LIBRARY_PATH=.
I get.
> java HelloWorld
The java class could not be loaded. java.lang.UnsatisfiedLinkError: ctest (A file or directory in the path name does not exist.)
Below tutorial gives similar issue
Calling C From Java Is Easy
I am not sure what is going wrong
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried that out but still get the same error
training-> export CLASSPATH=.:/usr/java5_64/jre/bin:/usr/java5_64/bin:/usr/java5_64/include
training-> print $CLASSPATH
.:/usr/java5_64/jre/bin:/usr/java5_64/bin:/usr/java5_64/include
training-> java HelloWorld
The java class could not be loaded. java.lang.UnsatisfiedLinkError: ctest (A file or directory in the path name does not exist.)
training-> ls
HelloWorld.class HelloWorld.java libctest.so
HelloWorld.h ctest.c
Sorry. Are you saying that you have got $CLASSPATH set?
Also, are you sure that there is no typo in the path?
Cheers, JP.
Also, are you sure that there is no typo in the path?
Cheers, JP.
Ok,
You could try;
to evaluate library dependencies.
Also try;
And see whether you have any 'load' system calls that look like they have failed in the output.
Cheers, JP.
You could try;
# ldd libctest.so
to evaluate library dependencies.
Also try;
# truss java HelloWorld
And see whether you have any 'load' system calls that look like they have failed in the output.
Cheers, JP.
ASKER
I checked there is no typo. Also I cross verify the commands, what they do.
The ldd(library dependencies) show
However on running truss I do see "Err#25 ENOTTY" not sure what it means.
Still it is not clear to me "what directory or path does not exist and where".
error-from-Truss-command.txt
The ldd(library dependencies) show
training-> ldd libctest.so
libctest.so needs:
/usr/lib/libc.a(shr.o)
/unix
/usr/lib/libcrypt.a(shr.o)
However on running truss I do see "Err#25 ENOTTY" not sure what it means.
Still it is not clear to me "what directory or path does not exist and where".
error-from-Truss-command.txt
The truss output doesn't show any obvious gotchas. I think the errnotty is not a problem here.
Is the 'HelloWorld' code your own? Perhaps there is something in your code that is making an incorrect system call to your ctest library.
Cheers, JP.
Is the 'HelloWorld' code your own? Perhaps there is something in your code that is making an incorrect system call to your ctest library.
Cheers, JP.
ASKER
The Example that I tried is:-
Calling C code from Java using JNI - URL :-
http://stuf.ro/calling-c-code-from-java-using-jni
Code is attached.
I verified path "/usr/java5_64/include" contains jni.h.
However what makes me think is, "if there is some other command for Java 5 ?"
HelloWorld.h
ctest.c
HelloWorld.java
Calling C code from Java using JNI - URL :-
http://stuf.ro/calling-c-code-from-java-using-jni
Code is attached.
//Command to execute is:-
java -Djava.library.path=.:/usr/java5_64/jre/bin:/usr/java5_64/bin:/usr/java5_64/include HelloWorld
//Output is :-
The java class could not be loaded. java.lang.UnsatisfiedLinkError: ctest (A file or directory in the path name does not exist.)
// the Java Version that was used
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pap64devifx-20110627 (SR12 FP5 ))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 AIX ppc64-64 j9vmap6423ifx-20110624 (JIT enabled)
J9VM - 20110623_85457_BHdSMr
JIT - 20100623_16197ifx10_r8
GC - FP22011_06)
JCL - 20110627
I verified path "/usr/java5_64/include" contains jni.h.
However what makes me think is, "if there is some other command for Java 5 ?"
HelloWorld.h
ctest.c
HelloWorld.java
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad you got it figured out in the end.
Cheers, JP.
Cheers, JP.
ASKER
i want to resend as my solution is the only solution and not others.
ASKER
Not knowing about -maix64 option in command like took a lot of my time
ASKER
I am putting the *.so in the path and LD_LIBRARY_PATH.
Is there anything else that i need to put on the path for this java file to run?