tags:

views:

478

answers:

1

I am using persevere for an application I am writing that controls remote hardwere. Persevere is written in Java and doesn't supply an alternative API.

I am using a web-based GUI as the control panel. So far, so good.

I can get and set data using REST channels like dojo does but the problem is that I don't really know how to use REST channels. Which library should I use to do so?

+2  A: 

If you use gcc as your toolchain you can embed a JVM with GCJ to run persevere inside your application. GCJ makes it easy to call C++ from Java with it's CNI interface (much easier than JNI). I used that method to use Java scripting inside our C++ application. You can even compile the persevere jar into a native library and link it to your app with GCJ.

The best reference is the GCJ Documentation.
There is also a Linux Journal contains the article Embedded Java with GCJ that you can read.
You can also study applications that use gcj.

lothar
Hmm nice idea and then I just interface directly with persevere?Is it more efficient then using REST channels?I know that you can pass 10 GB/sec if you send a internal socket.
the_drow
It should be as fast as you possibly can be as it boils down to function calls. With GCJ you effectively implement your Java classes in C++ and just let persevere call them. I ended up creating wrapper C++ implementations (encapsulating C++ exception handling) that I called from the GCJ code parts, as one can not mix Java and C++ exception handling in GCJ (yet). But otherwise it was a relatively painless experience.
lothar
Since I'm running on linux G++ fits.Do you have a running example that I can read?Also do you have a tutorial on the toolchain needed in order to invoke GCJ and G++?
the_drow