Jhandles on Linux – java.lang.Exception: invalid handle
Scott Haynes
scotth20 at hotmail.com
Thu Jun 5 23:36:49 CDT 2008
Hello all,
I compiled Jhandles-0.3.3 on my Fedora Linux machine using Java
jdk1.6.0_06.
Anyway I have all the oct and jar files built and paths set correctly
but surprise it still doesn't work. If I just give it a simple command
like plot(0:10) it dies with the following error message.
octave:6> plot(0:10)
error: [java] java.lang.Exception: invalid handle - 1.0
error: evaluating assignment expression near line 18, column 7
error: called from `__get_object__' in file
`/usr/share/octave/packages/jhandles-0.3.3/__get_object__.m'
error: evaluating assignment expression near line 20, column 9
error: evaluating if command near line 19, column 3
error: called from `drawnow' in file
`/usr/share/octave/packages/jhandles-0.3.3/drawnow.m'
octave:7>
I first opened up the HandleObject.java to see what's going on. I don't
know java at all so I'm not sort of in the dark. Pasted below is the
code snipit of interest:
public static HandleObject getHandleObject(double handle)
throws Exception
{
WeakReference ref = (WeakReference)handleMap.get(new
Double(handle));
if (ref != null && ref.get() != null)
{
return (HandleObject)ref.get();
}
if (handle == 0)
return RootObject.getInstance();
throw new Exception("invalid handle - " + handle);
}
Obviously, I'm not getting to the return(HandleObject) statement because
of ref and ref.get.
Next at the octave command prompt I typed:
octave:7> obj = java_invoke ('java.lang.ref.WeakReference','get')
which returned
error: [java] java.lang.NullPointerException
error: evaluating assignment expression near line 7, column 5
octave:7>
I think this means ref.get is equal to null which is what is sending me
in the wrong direction. I still don't know how to determine what ref is
but I realize I'm in a bit over my head and it seems like a good point
to ask the group for some help. Can someone briefly explain what ref and
ref.get are?
I'd also be happy to share any info on how I managed to get this far if
anyone else is interested in running jhandles on linux.
Best Regards
--
Scott Haynes
More information about the Help-octave
mailing list