Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in findjobj (line 145) #47

Open
korkam opened this issue Oct 11, 2016 · 9 comments
Open

Error in findjobj (line 145) #47

korkam opened this issue Oct 11, 2016 · 9 comments

Comments

@korkam
Copy link

korkam commented Oct 11, 2016

Hi,

First of all, this seems like an awesome and timely toolbox. Thank you for creating and sharing it!

In testing out your GUIs (swa_SleepScoring, swa_Explorer), I'm running into this error for both:
% Undefined function or variable 'javachk'.
%
% Error in findjobj (line 145)
% error(javachk('awt'));
%
% Error in swa_SleepScoring>DefineInterface (line 98)
% jStatusBar = findjobj(handles.StatusBar);
%
% Error in swa_SleepScoring (line 8)
% DefineInterface

findjobj is in my file path and here are my creds:
% computer = PCWIN64
% >> ver
% MATLAB Version: 9.1.0.441655 (R2016b)
% Operating System: Microsoft Windows 7 Professional Version 6.1 (Build 7601: Service Pack 1)
% Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

Cheers,
Korey

@Mensen
Copy link
Owner

Mensen commented Oct 11, 2016

Hey Korey!

If you close the window, and re-open it does it always happen? I've been getting a similar error, but its quite sporadic and 90% of the time when I open the functions it works fine, and if not I just re-open and it generally works the next time.

The problem is when using the undocumented functions to access java properties of the figure (findjobj). The error is a strange one since it doesn't occur all the time when opening the functions. As far as I've understood it has to do with background java objects not being available when matlab asks for them, resulting in an error.

Let me know if its a persistent issue, or only occurs sometimes. Maybe I can finally get to the root of the problem and fix it once a for all.

@korkam
Copy link
Author

korkam commented Oct 11, 2016

Hey Armand,
I tried your trick and unfortunately it seems to be a persistent issue.

@Mensen
Copy link
Owner

Mensen commented Oct 11, 2016

Could you check for the existence of the function javachk?

It seems to be the function you're missing and findjobj is only failing because you don't have that function.

In my 2015b release which javachk returns:
/usr/local/MATLAB/R2015b/toolbox/matlab/lang/javachk.m

  • edit: just tried my 2016b release and its also an internal function there:
    /usr/local/MATLAB/R2016b/toolbox/matlab/lang/javachk.p

Its definitely a normal function that should also be found in 2016b:
http://ch.mathworks.com/help/matlab/ref/javachk.html

Let me know whether this function is in your path or not and we'll go from there.

@korkam
Copy link
Author

korkam commented Oct 12, 2016

Thanks for pointing that out.

which -all javachk; returns:
C:\Program Files\MATLAB\R2016b\toolbox\matlab\lang\javachk.p
C:\Program Files\MATLAB\R2016b\toolbox\matlab\lang\javachk.m % Shadowed

I'm stuck here. I'm familiar with removing directories from matlab's path,
but not "un-shadowing" or removing a specific file that may be necessary.

Any help here would be great!

On Tue, Oct 11, 2016 at 5:20 PM Armand Mensen notifications@github.com
wrote:

Could you check for the existence of the function javack?

It seems to be the function you're missing and findjobj is only failing
because you don't have that function.

In my 2015b release which javack returns:
/usr/local/MATLAB/R2015b/toolbox/matlab/lang/javachk.m

Its definitely a normal function that should also be found in 2016b:
http://ch.mathworks.com/help/matlab/ref/javachk.html

Let me know whether this function is in your path or not and we'll go from
there.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#47 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGFyJvAgTKO9U2_lUpz6kcCgdZIOyjpPks5qy_2EgaJpZM4KTte6
.

@Mensen
Copy link
Owner

Mensen commented Oct 12, 2016

Hmm...

My 2016b version also returns the ".p" variant... but works just fine, so this is not the root of your issue.

Are you familiar with setting breakpoints? Could you try setting a breakpoint at line 145 in findjobj, then running swa_Explorer, and then manually running javachk('awt') just to be sure that some other part of the scripts is not masking javachk later (which would be weird)

Both in the normal command window and while debugging in findjobj I get this response after running javachk('awt')...

ans = 

  0×1 empty struct array with fields:

    message
    identifier

If I try the function with some bad input like javachk('x')

ans = 

  struct with fields:

       message: 'This feature is not supported because:…'
    identifier: 'MATLAB:javachk:thisFeatureNotAvailable'

Such a strange problem you're facing.

@korkam
Copy link
Author

korkam commented Oct 12, 2016

After setting a breakpoint at line 145 in findjobj, I receive the same
output you've just posted:

javachk('awt')

ans =

0×1 empty struct array with fields:

message
identifier

javachk('x')

ans =

struct with fields:

   message: 'This feature is not supported because:…'
identifier: 'MATLAB:javachk:thisFeatureNotAvailable'

A caveat is that I do get your GUI window to open, but when I load your
example data set ('swaFile_5min_example.mat'), I receive this error:
%Reference to non-existent field 'fig'.

%Error in swa_Explorer>menu_LoadData (line 480)
%set(handles.fig, 'Name', ['Travelling Waves: ', swaFile]);

%Error while evaluating Menu Callback

On Wed, Oct 12, 2016 at 9:15 AM Armand Mensen notifications@github.com
wrote:

Hmm...

My 2016b version also returns the ".p" variant... but works just fine, so
this is not the root of your issue.

Are you familiar with setting breakpoints? Could you try setting a
breakpoint at line 145 in findjobj, then running swa_Explorer, and then
manually running javachk('awt') just to be sure that some other part of
the scripts is not masking javachk later (which would be weird'

Both in the normal command window and while debugging in findjobj I get
this...

ans =

0×1 empty struct array with fields:

message
identifier

If I try the function with some bad input like javachk('x')

ans =

struct with fields:

   message: 'This feature is not supported because:…'
identifier: 'MATLAB:javachk:thisFeatureNotAvailable'

Such a strange problem you're facing.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#47 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGFyJqV7Wx91ecgqPYKZPCewKLUucuS8ks5qzN0ggaJpZM4KTte6
.

@Mensen
Copy link
Owner

Mensen commented Oct 14, 2016

So I'm really confused by this error now.

In essence your original error indicates that it cannot find the function javachk... but if you try and run it on the command line or even at the breakpoint where it errors, it clearly finds the function, and it works, and has the correct output.

If you run to the breakpoint, then manually run the function (which you have done and it gives the correct output), and then just press "continue", does the function still error at that point or somewhere else?

There must be something else that I'm missing with your setup but it will be very hard to diagnose without direct access to your machine. It also seems to be a problem within the findjobj function which is not technically part of the swa-toolbox, only a dependency. If this persists I will try to talk to the creator if that function Yair Altman.

@korkam
Copy link
Author

korkam commented Oct 14, 2016

Thanks for your continued help. I re-verified your suggestion of breakpoint
usage and still get the same error:

swa_Explorer
145 error(javachk('awt'));
K>> javachk('awt')

ans =

0×1 empty struct array with fields:

message
identifier

Undefined function 'setVerticalAlignment' for input arguments of type
'handle.handle'.

Error in swa_Explorer>DefineInterface (line 314)
handles.java.StatusBar.setVerticalAlignment(javax.swing.SwingConstants.CENTER);

Error in swa_Explorer (line 3)
DefineInterface


Just to be sure, I removed all toolboxes from my path that may have
interfered. I wanted to test both of your viewers and tried to load your
example data.

As a test of swa_Explorer, I tried loading 'swaFile_5min_example.mat'. This
was the resulting error:
Reference to non-existent field 'fig'.

Error in swa_Explorer>menu_LoadData (line 480)
set(handles.fig, 'Name', ['Travelling Waves: ', swaFile]);

Error while evaluating Menu Callback

As a test of swa_SleepScoring, I tried loading 'swaData_5min_example.set'.
This was the resulting error:
Struct contents reference from a non-struct array object.

Error in swa_SleepScoring>menu_LoadEEG (line 273)
set(handles.StatusBar, 'String', 'Busy: Loading EEG (May take some
time)...'); drawnow;

Error while evaluating Menu Callback

Both GUI errors result from an error due to Menu Callback. Any idea what
might cause that?

On Fri, Oct 14, 2016 at 5:19 AM Armand Mensen notifications@github.com
wrote:

So I'm really confused by this error now.

In essence your original error indicates that it cannot find the function
javachk... but if you try and run it on the command line or even at the
breakpoint where it errors, it clearly finds the function, and it works,
and has the correct output.

If you run to the breakpoint, then manually run the function (which you
have done and it gives the correct output), and then just press "continue",
does the function still error at that point or somewhere else?

There must be something else that I'm missing with your setup but it will
be very hard to diagnose without direct access to your machine. It also
seems to be a problem within the findjobj function which is not technically
part of the swa-toolbox, only a dependency. If this persists I will try to
talk to the creator if that function Yair Altman.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#47 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGFyJi68a4V1HNFkTABjSuiBqyv-jwfWks5qz0kOgaJpZM4KTte6
.

@Mensen
Copy link
Owner

Mensen commented Oct 16, 2016

That's actually not the same error :) which is progress of a kind.

The first error was undefined function or variable javachk... and now its setVerticalAlignment...

This error however I do know, and it only occurs intermittently based on some java processes running in the background. This is the error that generally disappears after restarting once or twice.

So the hope is that the javachk error has resolved itself (somehow) and now you are left with this intermittent error which (for now) I hope goes away by closing the open figure window and restarting. But I will have a look for a permanent fix for this week because it annoys me a lot too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants