Error in findjobj (line 145)
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
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.
Hey Armand, I tried your trick and unfortunately it seems to be a persistent issue.
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.
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 [email protected] 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 https://github.com/Sinergia-BMZ/swa-matlab/issues/47#issuecomment-253049935, or mute the thread https://github.com/notifications/unsubscribe-auth/AGFyJvAgTKO9U2_lUpz6kcCgdZIOyjpPks5qy_2EgaJpZM4KTte6 .
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.
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 [email protected] 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 identifierIf 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 https://github.com/Sinergia-BMZ/swa-matlab/issues/47#issuecomment-253209702, or mute the thread https://github.com/notifications/unsubscribe-auth/AGFyJqV7Wx91ecgqPYKZPCewKLUucuS8ks5qzN0ggaJpZM4KTte6 .
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.
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 [email protected] 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 https://github.com/Sinergia-BMZ/swa-matlab/issues/47#issuecomment-253750381, or mute the thread https://github.com/notifications/unsubscribe-auth/AGFyJi68a4V1HNFkTABjSuiBqyv-jwfWks5qz0kOgaJpZM4KTte6 .
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.