[Top][All Lists]

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

Re: Basic question: usage of Java methods in Octave

From: Michael Goffioul
Subject: Re: Basic question: usage of Java methods in Octave
Date: Tue, 15 Oct 2013 18:13:32 -0400

On Tue, Oct 15, 2013 at 5:27 PM, PhilipNienhuis <address@hidden> wrote:
Fedemone wrote
> Hi Philip,
> sorry forr late answer, I forgot in previous days...
> You are right, the code is really ugly, and my duty right now is to
> reverse-engineer it, in order to make this third-party-code usable locally
> in Octave rather than Matlab.
> That's where all the problems rise, and I'm try to do what you suggest: to
> dissect, to de-assembly in simplier code and to understand what are the
> single elements (some are surely variables, other are functions declared
> elsewhere, Integer and Float should be Java classes... a real mess).
> By the way, trying to use the Java Method seems a bit less intuitive than
> expected:
> octave:1> x = javaMethod('floatToIntBits', 'java.lang.Float', 10.07)
> error: [java] java.lang.IllegalArgumentException
> Actually no numer is accepted in this way, and any manual I'm lookin ginto
> is lacking of the very basic introduction to method usage...

Starting off with the basics:

(Octave-3.7.7+ on MinGW)

>> x = javaObject ("java.lang.Float", 10.07)
x =

<Java object: java.lang.Float>

>> x.floatToIntBits
error: [java] java.lang.NoSuchFieldException: floatToIntBits

## Field? This doesn't look right.

>> javaMethod ("floatToIntBits", x)
error: [java] java.lang.NoSuchMethodException: floatToIntBits

## ???? This doesn't look right either, because:

>> methods (x)
Methods for class java.lang.Float:
boolean equals(java.lang.Object)
java.lang.String toString()
java.lang.String toString(float)
int hashCode()
int floatToRawIntBits(float)
int floatToIntBits(float)
: it should just work. After all,


just works fine.

Perhaps file a bug report? What do you think, Michael?

I'm not 100% sure you can call static method with an object context as you're trying to do. I would expect you can, but it's worth checking in Matlab. It it's supported, then yes it's a bug. I suppose the problem comes from the fact that static methods are not considered when looking for a matching method in the above code.


reply via email to

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