On Jan 25, 2008 1:23 PM, Olivier Lefevre <[EMAIL PROTECTED]> wrote: > You write: "[the javapackage] will be [initialized] automatically > by the octave engine when it needs it; [it] is able to attach itself > to a running JVM" etc, in other words you see a big role for the > java package but since it is for calling Java from Octave and I > want to do the opposite, I am confused.
Well, the java package is the glue between octave and Java. Up to now, it has only been used to do octave->java, but a large part of it can be used to do java->octave as well (the box/unbox conversion functions are the same, the Matrix.java class...). So let's say the java package contains everything you'd need: the OctaveEngine class is part of octave.jar, while it's JNI implementation is provided by __java__.oct. You have octave installed along with the java package in the standard locations. Then you can use the OctaveEngine class from your Java app provided that: 1) you put octave.jar into the classpath 2) define the few system properties that are required to make things work (mainly related to path locations): you can see what's actually needed by looking at this example http://visual-octave.svn.sourceforge.net/viewvc/visual-octave/trunk/console/virtualconsole/src/org/octave/ide/script/virtualconsole/octave/OctaveWrapper.java?revision=37&view=markup > > It depends on what you want to exchange. Making java code > > to access octave data directly is not possible, because octave > > C++ data is not part of the java-managed memory space. > > I need to brush up my JNI: it's been a while, but I thought they'd > end up in the same process space, precisely. They are in the same process space, but not in the same memory space. Let's say you have a array of doubles in C++ (double[] a). You can't make you java code access this array directly. You must copy the double data into a java double[] object, then it can be accessible from java code (the conversion is done using JNI code). Michael. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev