help-octave
[Top][All Lists]
Advanced

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

Re: retrieving a fields of java object with a private constructor


From: Mike Miller
Subject: Re: retrieving a fields of java object with a private constructor
Date: Mon, 7 Jul 2014 18:34:23 -0400

On Mon, Jul 7, 2014 at 23:24:44 +0100, Carnë Draug wrote:
> Hi
>
> to access a field from a java object, I would usually do:
>
>  x = javaObject (class_name).field_name;
>
> However, the class I am trying to use now (loci.formats.FormatTools) [1]
> does not have a public constructor [2] so the previous fails:
>
>> a = javaObject ('loci.formats.FormatTools')
> Exception in thread "main" java.lang.NoSuchMethodException:
> loci.formats.FormatTools
>     at org.octave.ClassHelper.invokeConstructor(ClassHelper.java:402)
> error: [java] java.lang.NoSuchMethodException: loci.formats.FormatTools
>
> This is a not a bug as indeed there is no constructor. How can I access a
> field value in this case? I am specifically trying to access the field
> VERSION. It seems that in Matlab, aside the functional form of interacting
> with java (javaObject and javaMethod), one can do
>
>  x = loci.formats.FormatTools.VERSION;
>
> which is not yet implemented in Octave.

Yep, see open bug #41239 [1]. You can use java_get() with the java
package and with Octave version 3.8.0-4.0.x, but it's gone in 4.1.0+
so classdef had better work with Java for 4.2.0 :)

[1] http://savannah.gnu.org/bugs/?41239

-- 
mike



reply via email to

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