| Intro | acdk.java.AcdkObject | acdk::java::JavaObject | Type mapping | Compile acdk_java |
With the ACDK class acdk::java::JavaObject you can use any Java class
inside C++ using the standard DMI interfaces.
Content of this chapter: |
// create a new java object ::acdk::java::RJavaObject jo = new ::acdk::java::JavaObject("java/lang/StringBuffer", (const char*)"Hello"); // call the method append of the the java object jo->invoke("append", (const char*)" Java from ACDK"); // call the method toString of the Java object RObject str = (RString)jo->invoke("toString"); // get the static public member of the java object RObject jout = ::acdk::java::JavaObject::peek_static("java/lang/System", "out"); // call the invoke method of the ::acdk::langObject // The DMI automatically dispatches the call to the // corresponding Java Object jout->invoke("println", str); RObject aout = System::out; // Same interface works also with ACDK objects. aout->invoke("println", str); |