[email protected] wrote:
 > Dear Octave developers,
 >
 >
 > I had used the "java" package some time ago to interact
 > with my Java class library from Octave.
 >
 > Recently I upgraded to a more recent version of Octave
 > (3.2) and the java package 1.2.6.

The current java package version is 1.2.7


 > Now I have two issues:
 >
 > ----- First: -----
 > I notice that the docs for this package are almost
 > nonexistent. I can only find a terse list of functions,
 > on Octave-Forge, which declares most fucntions with a
 > "Not implemented." note.
 >
 > For example http://octave.sourceforge.net/java/overview.html
 > says:
 >
 > java_invoke - not implemented
 >
 > It is not clear, why java_invoke is working then.
 > QUESTION:  Is it in a different package or is the
 > documentation incomplete? Am I looking in the wrong place?

Clearly the docs lag a bit behind and yes they are a bit incomplete, too :-)

java_invoke, java_new, java_get & java_set are implemented.

If you want to be sure which functions are implemented, glance through 
the java source code on svn. That's one of the ways I found out which 
functions do exist.

 > BTW: is there any documentation with examples etc how to
 > use the java package?  Should I prepare and submit something
 > like that?

If you have time & motivation to prepare useful java/octave howto 
documentation, please have a go.

As for examples, you can peek at the various java function files 
(m-files) for spreadsheet I/O in the IO package that I wrote a while 
back. From your description above I conclude that you probably know more 
about java than me, but anyway see here:

http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/io/inst/

Disclaimer: I'm by no means a java expert. I managed to get this stuff 
working, but I had to search a lot in source code / google / ... to find 
out from scratch how to invoke java from octave.
So I quite second your plea for more complete java/octave docs.


 > ----- Second: -----
 > In the previous releasees I was able to access public array
 > elements in my classes directly:
 >
 > Java:
 >     in a class:
 >     ...
 >     public double Alfa[] = new double[100];
 >     ...
 >
 > Octave:
 >     disp ( myInstance.Alfa(1) );
 >
 >
 > When I try to run my old code with Octave 3.2,
 > I receive an error message:
 >
 > %% try to access array element of field directly fails:
 >> myInstance.Alfa(1)
 > error: [java] java.lang.NoSuchMethodException: Alfa
 >
 > %% check what my public field is (not a method):
 >> myInstance.Alfa
 > <Java object: double[]>
 >
 > %% now I assign the public field to an Octave variable:
 >> a = myInstance.Alfa
 > a =
 > <Java object: double[]>
 >
 > %% finally try to access the Octave varaible and voila:
 >> a(1)
 > ans =  0.034907
 >>
 >
 > While the workaround of assigning Java array fields to a
 > temporary Octave variable works, it would be more convenient
 > to be able to access the array elements directly.
 >
 > QUESTION: Can I do this and how?

If it worked before, there's no reason it shouldn't work now. But...

...some questions in return:
- What platform do you use (linux, windows, mac, ...)?
- What java jdk version did you use for developing your java library class?
- On what java jre does your code fail?
- What were the last octave version, java package version & java jdk 
version with which your library worked OK?

You might need to investigate a little bit further to be sure if there's 
a regression of functionality in newer versions of the java package.


Philip

------------------------------------------------------------------------------

_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to