Re: create an object with cni
Bryce McKinlay <[email protected]> Mon, 24 Jun 2013 13:28:53 +0100
| Newsgroups | gmane.comp.gcc.java.devel |
|---|---|
| Message-ID | <CALUNu-r9t7jfO6iV0AbYzgjFXkecaO_rVJ=x_7C19RyzYtXVsw@mail.gmail.com> |
On Mon, Jun 24, 2013 at 1:17 PM, Bucher Fabio <[email protected]> wrote: > Thank you, I can run this example and I put my code in there. Which is the right namespace to use, and which Class do I have to load with the JvInitClass()-method? The namespace corresponds directly to the package name in Java. e.g. "java.util" becomes "java::util". If your java class has no package name then you don't need any namespace. > Now the error message says: > Test.cc:20:29: error: expected primary-expression before »)« token > Test.cc:21:29: error: typ specification expected > Test.cc:21:29: error: Java-object test is not with new allocated > Test.cc:21:29: error: »,« or »;« expected > > Do I have to load my Java-class with the JvInitClass()-method? I think yes, but how is it done the right way? Actually, no, you don't need to bother with JvInitClass in this case, because calling "new" will ensure that it is initialised automatically. The example only needs the JvInitClass() call because it is accessing a static Java variable, System.out. The correct syntax to reference your class would be: &Java_with_CNI::class$ (This is the CNI equivalent of "Java_with_CNI.class" in Java.) Bryce