Java exception error


Normally my code works fine, but sometimes when I try to rerun my code, mid-calculation it produces this error message. What might cause this error? How would I debug my code (it says there is an error on line 180 for example my code is no even 180 lines)?

edit: I’m pretty sure the problem is with my Dynare setup, since I also get the same error with other code. So the code works 1st time and then when I try to rerun it, it produces this error.

[code]Error using alternatePrintPath>LocalSetPaintDisabled (line 1111)
Java exception occurred:

at com.mathworks.hg.peer.FigureClientProxy.swapShowHandler(

at com.mathworks.hg.peer.FigureClientProxyPanel.setPaintDisabled(

at com.mathworks.hg.peer.PaintDisabled.setPaintDisabled(




at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.mathworks.jmi.AWTUtilities$Invoker$3$

at com.mathworks.mvm.context.ThreadContext.callWithContext(

at com.mathworks.mvm.context.MvmContext.callWithContext(

at com.mathworks.jmi.AWTUtilities$Invoker$3.runWithOutput(

at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(

at com.mathworks.jmi.AWTUtilities$

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

at java.awt.EventQueue.access$200(Unknown Source)

at java.awt.EventQueue$ Source)

at java.awt.EventQueue$ Source)

at Method)

at$1.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at Source)

Error in alternatePrintPath>printCleanup (line 314)

Error in alternatePrintPath>printSetup (line 212)

Error in alternatePrintPath (line 91)

Error in print (line 215)
pj = alternatePrintPath(pj);

Error in dyn_saveas (line 41)

Error in stoch_simul (line 256)
dyn_saveas(hh,[M_.fname ‘IRF’ deblank(tit(i,:))],options_);

Error in ramsey_policy (line 25)
info = stoch_simul(var_list);

Error in commitment (line 218)

Error in dynare (line 180)
evalin(‘base’,fname) ;[/code]

Unfortunately, the Matlab plot engine is not the most stable one. When it only occurs randomly, this is most probably not a Dynare issue. There is not much you can do, except for closing Matlab and opening it again. Or did your code crash during the first run? In this case, you might need to say

before rerunning the program.

NB: the error message refers to the line in dynare.m, not your mod-file!