This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: create an object with cni


On Mon, Jun 24, 2013 at 1:17 PM, Bucher Fabio <fabio.bucher@ntb.ch> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]