Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7130

Re: JNI accessing a class that instantiates another class

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: JNI accessing a class that instantiates another class
Date 2011-08-15 15:10 -0700
Organization Canadian Mind Products
Message-ID <q26j47dnvbcsn6ld591pchurg8p0l4poqv@4ax.com> (permalink)
References <d48afffd-0ff8-4cc4-a63b-45ffe01224e9@o11g2000yql.googlegroups.com>

Show all headers | View raw


On Mon, 15 Aug 2011 07:55:50 -0700 (PDT), Danno
<danmwall-google@yahoo.com> wrote, quoted or indirectly quoted someone
who said :

>  The only problem is, when
>the Java class attempts to create an instance of this second, inner
>class, it dies.  I don't get an error, it just doesn't work.

This why JNI is so difficult.  The Java trace will not follow the code
through it.  Is there anything that will do that?  

My rule of thumb is to do everything in Java you possibly can, and do
only in C++ what you can't do in Java.

You might consider creating the object in Java and passing it in as a
reference.

To handle it the way you want, however, create a test program that
does absolutely nothing else but create a Java object in JNI. That way
you get all distractions out the way. Also scan the net for sample
code that creates Java objects in C++ to see if there is some catch.

If you don't have a textbook, get one. Almost nothing about JNI is
obvious.

see http://mindprod.com/jgloss/jni.html
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Most of computer code is for telling the computer
what do if some very particular thing goes wrong. 

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

JNI accessing a class that instantiates another class Danno <danmwall-google@yahoo.com> - 2011-08-15 07:55 -0700
  Re: JNI accessing a class that instantiates another class Florian Weimer <fw@deneb.enyo.de> - 2011-08-15 19:06 +0200
    Re: JNI accessing a class that instantiates another class Danno <danmwall-google@yahoo.com> - 2011-08-15 12:28 -0700
      Re: JNI accessing a class that instantiates another class Florian Weimer <fw@deneb.enyo.de> - 2011-08-15 21:50 +0200
  Re: JNI accessing a class that instantiates another class Roedy Green <see_website@mindprod.com.invalid> - 2011-08-15 15:10 -0700

csiph-web