octave-maintainers
[Top][All Lists]
Advanced

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

octave in java


From: Ernst Reissner
Subject: octave in java
Date: Fri, 5 Aug 2016 14:56:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2

Hi all,

I just tried in octave:

octave:1> debug_java(1)
octave:2>
javaMethod('load','java.lang.System','/home/ernst/Octave/octave/.build/libinterp/.libs/liboctinterp.so')
ans = [](0x0)
octave:3>  oct=javaObject('org.octave.Octave')
oct =

<Java object: org.octave.Octave>

octave:4>  javaMethod('needThreadedInvocation',oct)
ans = 1

What means that one can invoke from within octave the java function
needThreadedInvocation'

which in turn is defined native in the java class org.octave.Octave

and which is provided by liboctinterp.so.


So far so good.

Then I try the (much more interesting) method doEvalString and use it to
evaluate sin(1).

The result is

octave:10> javaMethod('doEvalString','org.octave.Octave','sin(1)')
error: 'nargin' undefined near line 36 column 7
terminate called after throwing an instance of 'octave_execution_exception'
panic: Aborted -- stopping myself...
attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete
Aborted

I do not at all understand this output.

Seems to have to do with the fact, that doEvalString has an input argument.

I presume that it is for sin that nargin is undefined.

I tried also with pi instead of sin(1), same effect.


What works out relatively ok is 42:

octave:3>  javaMethod('doEvalString','org.octave.Octave','42')
ans =  42
ans = [](0x0)
octave:4>
The second ans is the output of function javaMethod.

I can also do

javaMethod('doEvalString','org.octave.Octave','b=42;');


and then

octave:8> b
b =  42


so the problem is just invocation of functions.


Who can help?








reply via email to

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