From: Jim <k4...@be...> - 2008-08-17 15:44:33
|
I'm trying to figure out how to actually develop java library from c++ code. I've put a couple of simple classes together and done the following: swig -c++ -package com.fay.test -outdir src/com/fay/test -java demo.i gcc -I ${JAVA_HOME}/include -I ${JAVA_HOME}/include/linux -c demo_wrap.cxx ld -G demo_wrap.o -o libdemo.so Which worked fine. My interface looks like: %module book %{ #include "book.h" %} /* Let's just grab the original header file here */ %include "book.h" %module document %{ #include "document.h" %} Book has a reference to the Document class. When I attempt to compile the java files I get: jim@chinaberry:~/c++/src/com/fay/test$ javac *.java Document.java:31: cannot find symbol symbol : method delete_Document(long) location: class com.fay.test.bookJNI bookJNI.delete_Document(swigCPtr); ^ Document.java:37: cannot find symbol symbol : method new_Document() location: class com.fay.test.bookJNI this(bookJNI.new_Document(), true); ^ Document.java:41: cannot find symbol symbol : method Document_document_set(long,com.fay.test.Document,long) location: class com.fay.test.bookJNI bookJNI.Document_document_set(swigCPtr, this, SWIGTYPE_p_string.getCPtr(value)); ^ Document.java:45: cannot find symbol symbol : method Document_document_get(long,com.fay.test.Document) location: class com.fay.test.bookJNI return new SWIGTYPE_p_string(bookJNI.Document_document_get(swigCPtr, this), true); That's after I cd'ed to the source directory. The same thing happens if I do: javac src/com/fay/test/*.java So how do I compile? Environment: Ubunty 8.04, java package: sun-java6-jdk , 2.6.24-19 kernel, Thanks, Jim. |