From: Bryce McKinlay <bmckinlay@gmail.com>
To: Bucher Fabio <fabio.bucher@ntb.ch>
Cc: "java@gcc.gnu.org" <java@gcc.gnu.org>
Subject: Re: create an object with cni
Date: Mon, 24 Jun 2013 10:27:00 -0000 [thread overview]
Message-ID: <CALUNu-pSSsU7tkaHifd-K=8TZS0sC+Lzi+y4mY3S1ZbULd3uqA@mail.gmail.com> (raw)
In-Reply-To: <17B34E365AFABC468216733E4B4CC75492AD7EF3@mail-server.ntb.ch>
Fabio,
You need to initialise Java by calling "JvCreateJavaVM(NULL);" before
making calls from C++ into Java code.
See the CNI documentation (§ 11.16.2) for a complete example:
http://gcc.gnu.org/onlinedocs/gcj/Invocation.html#Invocation
Bryce
On Mon, Jun 24, 2013 at 10:37 AM, Bucher Fabio <fabio.bucher@ntb.ch> wrote:
> Hi
>
> I just have a simple programm: One Java class, one C++ class.
>
> Java:
> public class Java_with_CNI {
>
> public Java_with_CNI(){
> }
>
> public void printHello(){
> System.out.println("Hallo Du, ich wurde durch CNI aufgerufen");
> }
> }
>
> and my C++ class:
> #include <gcj/cni.h>
> #include "Java_with_CNI.h"
>
> class Hallo{
> int main(){
> Java_with_CNI test = new Java_with_CNI::Java_with_CNI();
> test.printHello();
> return 0;
> }
> };
>
>
> This is my first time i use C++, so I dont know whats wrong with my class. I just want to create a new Object (Java_with_CNI) and call the printHello()-method.
> What is wrong with my class?
>
> Thank you for your help and best regards
> Fabio Bucher
>
>
>
>
next prev parent reply other threads:[~2013-06-24 10:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 9:37 Bucher Fabio
2013-06-24 10:27 ` Bryce McKinlay [this message]
2013-06-24 12:17 Bucher Fabio
2013-06-24 12:28 ` Bryce McKinlay
2013-06-24 12:54 Bucher Fabio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALUNu-pSSsU7tkaHifd-K=8TZS0sC+Lzi+y4mY3S1ZbULd3uqA@mail.gmail.com' \
--to=bmckinlay@gmail.com \
--cc=fabio.bucher@ntb.ch \
--cc=java@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).