From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17305 invoked by alias); 24 Jun 2013 10:27:40 -0000 Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org Received: (qmail 17283 invoked by uid 89); 24 Jun 2013 10:27:38 -0000 X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-we0-f170.google.com (HELO mail-we0-f170.google.com) (74.125.82.170) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 24 Jun 2013 10:27:37 +0000 Received: by mail-we0-f170.google.com with SMTP id w57so8167042wes.1 for ; Mon, 24 Jun 2013 03:27:34 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.243.129 with SMTP id wy1mr16166978wjc.47.1372069654762; Mon, 24 Jun 2013 03:27:34 -0700 (PDT) Received: by 10.194.83.194 with HTTP; Mon, 24 Jun 2013 03:27:34 -0700 (PDT) In-Reply-To: <17B34E365AFABC468216733E4B4CC75492AD7EF3@mail-server.ntb.ch> References: <17B34E365AFABC468216733E4B4CC75492AD7EF3@mail-server.ntb.ch> Date: Mon, 24 Jun 2013 10:27:00 -0000 Message-ID: Subject: Re: create an object with cni From: Bryce McKinlay To: Bucher Fabio Cc: "java@gcc.gnu.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-06/txt/msg00004.txt.bz2 Fabio, You need to initialise Java by calling "JvCreateJavaVM(NULL);" before making calls from C++ into Java code. See the CNI documentation (=A7 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 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 > #include "Java_with_CNI.h" > > class Hallo{ > int main(){ > Java_with_CNI test =3D 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 printHell= o()-method. > What is wrong with my class? > > Thank you for your help and best regards > Fabio Bucher > > > >