Hi All,
First I would like to say Greetings, I am new to this forum.
I am working on a research project at NC State University and one of the tasks that I have is to integrate a java GUI interface with some c code.
due to the nature of the project, the GUI will be updated on an event based system in which it will receive calls from a c program that is gathering information on a hand made device.
The call from the c program will be of the form UpdateGUI(new Datapoints).
The question I have is in regards to this interaction. Since from my understanding of JNI thus far, the c code will instantiate a new JVM and then call the java code, what does that mean for my JVM and java code that is already up and running.
How I imagine designing this system is somewhat as follows:
Some sort of gui interface that has visual elements that need to be updated or changed depending on datapoints that we receive.
The c program will obtain a new datapoint and call a method in the java code that updates all the information that it needs to, and then the GUI will display the new information.
The GUI needs to be able to run even if the c code fails or the device failes (just display values of null)
So for a test I was going to write code where the c randomly generates a number and the java just puts the number to the screen, the c will query for keyboard input and if it receives an 'x' will change the color of the screen between blue and green. The c program will send this data over at a rate of 10Hz (I really cant have that many virtual machines running at once)
Can somebody help explain this to me, or let me know what should happen or at least point me somewhere that has more details.
Potential Solutions:
C launches Java gui and maintains a pointer to that jvm and can call java code that way.
can c use a jvm that already exists on the machine? How do I do this?
can java call a c method and get a return type? Say I want to return a type called datapoint (custom object with arbitrary attributes/methods), is that possible?