Version 3 (modified by 14 years ago) (diff) | ,
---|
SIMEO - Compiled Native Interface
System: Ubuntu 9.10
Requirements:
- libgcj10-dev
- gcj-jdk
Compilation Steps
$ javac Test.java $ gcjh -cp . Test $ gcj -c Test.java
Sample Code
#include <gcj/cni.h> #include <java/lang/System.h> #include <java/io/PrintStream.h> #include "Test.h" using namespace java::lang; // ... void init() { if(JvCreateJavaVM(NULL) < 0) { printf("Error creating the JVM!!!\n"); exit(1); } JvAttachCurrentThread(NULL, NULL); } void test() { String *msg = JvNewStringLatin1("The JVM is ready!"); JvInitClass(&System::class$); System::out->println(msg); JvInitClass(&Test::class$); Test *obj = new Test(); obj->test(); }