hello everybody
i am writing a jni for some api's in c++ in linux
i sending vector as parameter and returning a vector through the same function.
all i need to do is
read a file put all the lines in vector.
pass the vector object as parameter to function 4m java,
read the vector retrive single line and pass it to the c++ function.
code :
public class classify {
25
26 public static native Vector Submit(Vector vecData);
27 static
28 {
29 String appPath = System.getProperty("user.dir");
30 System.load(appPath + "/libclassifyJni.so");
31
32 }
33 public static void main(String args[])
34 {
35
36 try{
37
38 Vector vecData=new Vector();
39 String dirName=args[0];
40 System.out.println("the dir name is "+dirName);
41 String text="";
42 File dir = new File(dirName);
43 String children[] = dir.list();
44 if (children != null)
45 {
46 for (int i=0; i<children.length; i++)
47 {
48 // Get filename of file or directory
49 String path;
50 String filename = children;
51 if(dirName.startsWith("."))
52 {
53 path = System.getProperty("user.dir");
54 path += dirName.substring(1);
55 path += "/";
56 path += filename;
57 }
58 else
59 path = filename;
60
61 FileReader fstream = new FileReader(path);//txt
62 BufferedReader br = new BufferedReader(fstream);
63 String headerArr[]=null;
64 String header=br.readLine();
65 headerArr=header.split("\\:\\:");
66
67 String cddType=headerArr[2];
68 // System.out.println("header type is:"+cddType);
69 while((text=br.readLine())!=null)
70 {
71 vecData.addElement(text);
72
73 }
74 }
75
76 Vector vecObj=new Vector();
77 vecObj = Submit(vecData);
78
79 for (Enumeration e = vecObj.elements();e.hasMoreElements();)
80 {
81 String myString = (String) e.nextElement();
82 // System.out.println("String: "+myString.toString());
83 }
84
85 }
86 else
87 {
88 System.out.println("\nDirectory is EMPTY !!");
89 }
90 }
91 catch(Exception e)
92 {
93 System.out.println(e);
94 }
95 }
but in java i m getting this error
An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0x0000002a959320cb, pid=11361, tid=182894179040
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (1.5.0_01-b08 mixed mode)
# Problematic frame:
# V [libjvm.so+0x3b60cb]
#
# An error report file with more information is saved as hs_err_pid11361.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Aborted
[vandana@SIOCR001 JWrapper]$ java classifyPckg.classify ./cdd
can u plz help me out
why am i getting this error
regards
vps