Posted By:
Ramkumar_Sundaram
Posted On:
Friday, May 11, 2001 02:46 PM
Hi I have a java program that calls a "C" function thru JNI call. If the "C" function is called 4/5 times its working fine. But in case its called more than 7/8 times it hangs. I believe there is no bug in the "C" program. And also when it is called lesser no. of times its working fine. I attach the code below : ------------------------------- public class TestJni { public static void main(String a[]) { int nooftimes = 0; if(a[0] != null) { nooftimes = Integer.parseInt(a[0]); } else nooftimes = 3; for(int i=0; i < nooftimes ; i++) { ClassO
More>>
Hi
I have a java program that calls a "C" function thru JNI call. If the "C" function is called 4/5 times its working fine. But in case its called more than 7/8 times it hangs.
I believe there is no bug in the "C" program. And also when it is called lesser no. of times its working fine.
I attach the code below :
-------------------------------
public class TestJni
{
public static void main(String a[])
{
int nooftimes = 0;
if(a[0] != null)
{
nooftimes = Integer.parseInt(a[0]);
}
else
nooftimes = 3;
for(int i=0; i
< nooftimes ; i++)
{
ClassOne objone = new ClassOne();
String str = objone.genString();
System.out.println("string is : " + str);
}
}
}
--------------------------------------
--------------------------------------
public class ClassOne
{
public native String genString();
static
{
System.out.println("Loading the Library : strgen");
System.loadLibrary("strgen");
System.out.println("Library : strgen Loaded");
}
}
----------------------------------------
I feel that the library which has been loaded is not getting unloaded.
<<Less