Clear Filters
Clear Filters

Why does R2013b keyboard freeze when toggling X11 forwarded windows?

1 view (last 30 days)
Background: I'm accessing R2013b on a remote Linux server from Windows 7 via X11 forwarding (Xming and PuTTY). From the shell command line, I start Matlab with: matlab2013b &. Nothing fancy.
The problem: R2013b loads appropriately: I can enter commands in the command window with the keyboard. When I toggle window focus (for example, I click on a Matlab figure window or on the Windows 7 desktop background and then back to the command window), the command window regains focus. Although the toggled-focus command window accepts mouse-click input, such as highlighting text, no flashing cursor appears at the command line and keyboard input is not displayed. At this point I cannot continue using Matlab and I must kill the process.
Other information: I have tried the above on multiple Win7 machines with the same result. The problem did not arise when accessing the remote machine from a Linux machine via ssh -X in a terminal window. The problem did not arise when running matlab2012b.
Marc on 15 Jun 2014
Have you or anyone submitted a request to tech support?
Just to clarify, you don't have a Matlab license on your machine. You are trying to access a Matlab license on a server?
Have you contacted the Linux server administrator?

Sign in to comment.

Accepted Answer

Moritz on 26 Jun 2014
I received a helpful answer from the Matlab support to a Service Request I submitted. Basically you got two options that might help:
1) trying a different X server such as: 2) updating Java to version 7 update 60.
For me the first option fixed all the issues and I can really recommend the mobaXterm ssh-terminal.
Here is the full answer I received:
_"Hello Moritz,
I am writing in reference to your Service Request, Case #01009102 regarding 'Keyboard Freeze during X11-forwarding'.
Apologies for the delay in your answer. MATLAB is tested on machines that contain a local and default installation of the the relevant operating system. Excepting compilers for use with MEX functionality, no additional packages are installed on these machines. Please note that the implementation of X11 on the Linux machines used for testing will vary and depends which implementation the Linux distribution on that machine uses. For example, in the case of Debian, this implementation is based on Xorg. We do not support the use of MATLAB with, for example, XFree86.
The operating system and the machine must meet the requirements of the particular release of MATLAB in question. For specifics, please refer to the following link:
Third-party X-servers and X-forwarding are not supported and are not guaranteed to work. More broadly, MathWorks does not guarantee that MATLAB will use of any particular method for graphics rendering. The techniques that are used depend the component, platform, and release. For MATLAB 7.14 (R2012a) on Linux, MATLAB graphics rest on components, such as Java that are implemented in X11.
For your case in particular the behavior your experience has been observed with the following combination:
- MATLAB 8.2 (R2013b) - Windows local machine - Linux remote machine - Xming Server or Cygwin X11 on the Window PC - SSH tunnel X11 forwarding using PuTTY
This appears to be an issue with Java 7 that did not exist in Java 6. MATLAB R2013b is the first version of MATLAB that uses Java 7. The Development team has been made aware of the same.
Some workarounds that have been known to work for few customers are:-
1) trying a different X server such as: 2) updating Java to version 7 update 60.
However, please note that updating the Java version is not a supported workflow. To verify that MATLAB is using the correct version of the JVM software, type the following at the MATLAB prompt:
>> version -java
Information on how to do this upgrade can be found in the following link:
(The link refers to Mac OS X but the work-flow is the same for Linux)_
  1 Comment
Terry McKiernan
Terry McKiernan on 18 Mar 2015
Hello all,
I had this same problem with MATLAB 2014b and resolved it by updating the version of Java used by MATLAB, as suggested in option 2 of the reply from tech support.
Specifically, I installed Oracle's JRE 1.7.0_75 (latest as of today) on the Linux server, set MATLAB_JAVA to the new JRE install folder, then ran MATLAB 2014b with the display sent to my PC. On my PC I'm using Windows 7, PuTTY 0.63 and Xming in multiple-window mode. Everything worked fine -- I was able to switch windows, open plots, open the MATLAB editor, etc.

Sign in to comment.

More Answers (11)

Jens Henrik Göbbert
Jens Henrik Göbbert on 11 Jun 2014
make sure sun.java2d.pmoffscreen=false is set for all JAVA Matlab uses. You have different options to achive this:
a) [...] put a file called "java.opts" containing the Java option "-Dsun.java2d.pmoffscreen=false" into the directory matlabroot/bin/*system*/.
b) [...] adding a file called “java.opts” to the working directory of your Matlab session, containing the line “-Dsun.java2d.pmoffscreen=false”. This has been found to speed up the performance of Matlab on the cluster.
c) [...] create a file call java.opts with a statement -Dsun.java2d.pmoffscreen=false under the home directory.
It would be great to know, how to check within Matlab if certain settings have been read. Any ideas?

Colby on 9 Oct 2014
I had almost the same problem (MATLAB would not focus) when displaying from a Linux machine to OS X (various versions of OS X, MATLAB, Xquartz, and Java were tried with no solution). After suffering for a few years (VNCing into another Linux machine, forwarding X11 to that Linux machine, and displaying via VNC to my OS X machine), I finally searched for just the right phrases, and found these pages:
Now it works for me. I just use "ssh -Y" instead of "ssh -X" and the problem is gone. I can focus on the MATLAB window and type into it. I hope that helps someone else.

Xiangrui Li
Xiangrui Li on 18 Dec 2013
Edited: Xiangrui Li on 18 Dec 2013
I am having exactly the same problem, although I haven't tried other matlab versions due to access issue. Anyone has a solution? Thanks. -Xiangrui

Jody on 3 Jan 2014
I'm having the exact problem. Running Matlab R2013b, Secure CRT and XMing. Going to try another Xwindows program next.

Xiangrui Li
Xiangrui Li on 9 Jan 2014
Due to the above problem, I am using VNC viewer for now. The keyboard almost works fine, except several keys on the number pad. When NumLock is on, pressing 0 paste the clipboard content then input 0
4 delete previous char and input 4
7,8,9 delete the whole line and input the number
Other number pad keys seem fine.
It seems this is matlab related issue, since there is no problem with other applications in the VNC viewer.
Any idea to fix this? Thanks.

Matthew Phillips
Matthew Phillips on 5 Feb 2014
Edited: Matthew Phillips on 5 Feb 2014
I'm having this exact same problem. (Client is running Windows 8 in my case.) Could somebody at Mathworks please look into this, otherwise the compute server I'm trying to run it on sits idle. I don't have privileges to install VNC or other workarounds.

Pál Dömötör
Pál Dömötör on 11 Mar 2014
I am having the same problem. If i am clicking to an other window or start an app, the cursor does not come back. Only way that i found is undock the command window. After undock and dock i have cursor again and i can click out from the window without lose the cursor.But after app starting or plot i do not have cursor again on command window. my Matlab version is R2014a. Running on linux(ubuntu(64)) and export the display to windows7(32). I try it with "export $DISPLAY" and with "matlab -display mydisplay" too.

Pál Dömötör
Pál Dömötör on 12 Mar 2014
Edited: Pál Dömötör on 12 Mar 2014
I try today Cygwin(with OpenBox) as "XServer" on windows and NO PROBLEM with the cursor. Without Openbox it still wrong.
  1 Comment
Matthew Phillips
Matthew Phillips on 1 Apr 2014
It works, but unfortunately I find that it's annoyingly difficult to switch between windows--only clicking on the top border will bring it to focus. For this reason I would still really like Matlab to fix the X11/XMing issue!

Sign in to comment.

Affan on 13 Jun 2014
Edited: Affan on 13 Jun 2014
Has there been any update to this? This is extremely frustrating and makes MATLAB unusable. The solution by @Jens did not work for me.
Edit: a possible solution: Launch matlab, switch to local window (cursor should disappear), go back to matlab, undock the command window, and dock it back. For me this seems to bring the cursor back even after switching windows.

Moritz on 20 Jun 2014
Exactly the same problem. Is there any solution to this problem yet? If not I queue in and plead the matlab team to tackle this issue and debug Matlab ... Jen's answer helps to speed up my Matlab, but does not help me to keep the cursor active during a session.

Affan on 24 Jun 2014
Can someone please create a ticket for this. I've already created one but for some reason my school's license number is invalid. This is a really really annoying problem and I am considering switching to R.
  1 Comment
Affan on 24 Jun 2014
EDIT: I have sort of FIXED this problem. When you launch X11, there are a couple of options. Instead of launching "multiple windows", I ran it in "one window" mode. Turns out that everytime I tried to do something, XMing crashed. It turns out it was a font problem, so I downloaded all the fonts for Xming (for my local computer, search Xming Fonts) and now if I run it in "one window" mode, everything flies beautifully.
Now, I can't do this process on my uni's lab computers as I can't install the fonts on Xming as I don't have privelges. But who knows, your IT admin may have already installed them.

Sign in to comment.


Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!