Loading .so file in java application on Linux
I have meet the question about java programming on linux platform.
I will load 'hello.so' file in hello.class in following statement:
static {
System.Loadlibrary("hello"):
}
but when run hello.class by typing 'java hello',system show the following:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no hello in
java.library.path
.
And I try another method :'java -Djava.library.path=. hello'
system show the same message.
What is wrong?
I need your help!
Thank you very much!
Boris :-)
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
how linux find .h?
When I compile c program by gcc in RedHat Linux 6.1,system cann't find all .h file that be include in my .c file. I have to indicate the whole path of these .h file. What is wrong? thank u very much! Boris :-) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
passing argments between java and c
hello,
I meet a question in passing argments between java and c.
In my java program,I call a method in a .dll file and pass a array to it.
In the .h file that generated by javah,function declaration is followling:
JNIEXPORT void JNICALL Java_call_aug
(JNIEnv *, jobject, jlongArray);
I write the following in my c file:
JNIEXPORT void JNICALL Java_call_aug
(JNIEnv *env, jobject obj, jlongArray a)
{
a[0]=1;
}
when I build it by vc++,vc++ show the fllowing:
D:\Boris\args\argdll\arg.cpp(26) : error C2679: binary '=' : no operator defined which
takes a right-hand operand of type 'const int' (or there is no acceptable conversion)
error line is a[0]=1;
How can I pass array ?Or,if I want pass data and want them changed in c ,then
return,how can i do?
Thanks
Boris :-)
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
How to draw a gragh with Jbuilder?
Hello: I want to draw a simple animated graph in Jbuilder3.The graph only has some lines and numbers ,and only appear in a fixed area.And it change per second.But I can not find useful information in help. Which class should I use? Where can I find some help ablut graph? btw: I know this is not a pure java mail list,but I can not find a good pure java list now.Who can tell me best mail list about java? Boris :-) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Tell me some excellent mail list about Jbuilder or pure java.
Hi, Who can tell ome excellent mail list about Jbuilder or pure java? Thank you very much! Boris :-) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
How to pass string between java and c?
Hello everyone!
I have a problem in passing string between java and c.
I will use native method writted in c ,and pass some string to c for processing.
The class to load liabrary is following:
public class loadIO
{
public native boolean write(char[] path, char[] name,char[] value);
static{
System.loadLibrary("IO");
}
}
I compile this class successfully and use javah to make a .h file for c.
In the .c file ,the method declaration is follwing:
JNIEXPORT jboolean JNICALL Java_IO_write
(JNIEnv *env, jobject obj, jcharArray path, jcharArray name, jcharArray value)
{
jchar * buf;
env->GetCharArrayRegion(path, 0, 100, buf);
...
}
The liabrary is compiled sucsuccessfully,but when I run java program ,the following
error message is printed:
java.lang.UnsatisfiedLinkError: write
at com.JiaTeng.adsl.adslCfgGui.ConfigDlg.(ConfigDlg.java:124)
at com.JiaTeng.adsl.adslCfgGui.ConfigDlg.(ConfigDlg.java:130)
at com.JiaTeng.adsl.adslCfgGui.ConfigDlg.main(ConfigDlg.java:161)
at symantec.tools.debug.MainThread.run(Agent.java:48)
Distinctly,the error occured in passing string between java and c.
But I don't know what is wrong in it,because native is difficult to debug.
Who anyone can tell me where the bug is ?
If I use String instead of char[],the corresponding type in c is jarray.
How can I process jarray type in c?
Thank you very much!
Boris
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
passing string between c and java (2)
I still can't resolve the question in Issue 151 now.
I have put two System.out.println("ok") statements before and after
System.loadLibrary("IO"),and I delete all statements in c method. And when I run
compiled
project,those two "ok" are printed, and then the same error information are printed:
java.lang.UnsatisfiedLinkError: write
at com.JiaTeng.adsl.adslCfgGui.ConfigDlg.(ConfigDlg.java)
at com.JiaTeng.adsl.adslCfgGui.ConfigDlg.(ConfigDlg.java)
at com.JiaTeng.adsl.adslCfgGui.ConfigDlg.main(ConfigDlg.java)
at symantec.tools.debug.MainThread.run(Agent.java:48)
Because java load the shared library correctly and c did nothing, the bug must be
in passing parameter between java and c.
But I do not know what is wrong.This bother me much more.
BTW:my platform is win98se,visual cafe 3.0.visual c++6.0
Thank you very much.
Best rewards.
Boris
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
install
hi :) i have downloaded jdk1.2 for Linux glibc2.0 and unpacked it and put bin directory in PATH and when I start any of the executables it says: libthread.so.0 : undefined symbol: __libc_rewinddir any help, please? boris
unsubscribe
unsubscribe
