An example of a Java application calling C, and the C calling Java methods?

From: Clayton E. Cramer (clayton_at_claytonDELETETHIScramer.com)
Date: 07/26/04


Date: Sun, 25 Jul 2004 23:11:11 -0600

I have been able to use the JNI to write a Java application that calls C
functions, but I am having a heck of a time getting the C functions to
reliably call Java methods. I believe that the problem has to do with
multiple threads and not having the correct value for the JNIEnv when the C
function decides to invoke a Java method. There must be some way for a C
function to retrieve the current JNIEnv that invoked this C function,
without passing it in.

Please?



Relevant Pages

  • Re: JAVA as C (or C++) Front End
    ... Whenever I write and compile a ... > java program, I have to invoke it by calling Java.EXE. ... > software which is obviously written in Java which is invoked with an EXE ... One 'pro' for having the the C code invoke the java code is that you will then ...
    (comp.lang.java.programmer)
  • Re: java - invoke
    ... You have stumbled on one of the most subtle features of Java called ... You create call lists of parameters on the fly and invoke methods. ... It is a tool to allow java code to use arbitrary class files handed to ... You can usually get what you want without resorting to reflection ...
    (comp.lang.java.help)
  • Re: Problem Passing args to Java from Matlab
    ... just use a matlab string ... I'm using a java api from Matlab, and I can not get the call data ... Then I try to call invoke. ... str = java.lang.String ...
    (comp.soft-sys.matlab)
  • Need advise on using java for RPC
    ... I'm new to java and web services. ... string command to be used as input argument for my compute.exe ... the form of XML and send via http to the server. ... I set up a webservice using J2EE, how do I invoke my compute.exe? ...
    (comp.lang.java.programmer)
  • Re: finalize() not guaranteed to be called -- ever
    ... Then the Java object should have some kind of dispose method. ... It is very different in that it is possible to write C++ programs in which the destructors are never invoked manually but do run. ... C++ you can put objects on the heap as well and when you do the destructor is called manually using the delete statement. ... Either the object itself is stack based or you use a stack based object to invoke the ...
    (comp.lang.java.programmer)