help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Usage of java package


From: Philip Nienhuis
Subject: Re: Usage of java package
Date: Tue, 5 Jun 2012 09:51:00 -0700 (PDT)

Jose wrote
> 
> Hello.
> 
> I am trying to use the java package, but I have not found clear enough 
> documentation about how to use it to pass primitive data types, arrays 
> and matrixes from java to octave and viceversa.
> 
> After some search in Internet I tried to find JHandles, as it is 
> supposed to be using the java package, but I could not find it. Can 
> somebody point me to some examples?
> 
> A more concrete example of what I need.
> 
> In java I have (simplified)
> 
> public class MyClass
> {
>       public long numA;
>       public byte[] arrayB;
>       public int numB;
>       
>       public MyClass(long nA, byte[] aB, int nB)
>       {
>               this.numA = nA;
>               this.arrayB = aB;
>               this.numB = nB;         
>       }
>       //Other methods
> }
> 
> How do I call the constructor of MyClass from octave?
> How do I retrieve the values of numA, arrayB and numB in octave?
> 

In the io package there are loads of script files for spreadsheet support
that invoke numerous Java methods and (implicit) constructors, see esp.
subfunctions in odsopen.m, xlsopen.m, xlsclose.m, odsclose.m, oct2ods.m,
ods2oct.m, xls2oct.m, oct2xls.m, getusedrange.m, etc.

Especially the UNO-Java bridge was troublesome to get working; the relevant
subfunctions contain several tricks for creating objects using type casting
that often needed unexpected workarounds. There are links in the comment
lines to (URLs) relevant Java code that was used as template.

Philip


--
View this message in context: 
http://octave.1599824.n4.nabble.com/Usage-of-java-package-tp4630533p4630552.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]