MATLAB: Error when trying to run deploytool in console with no display

deploytool nodisplay compilerMATLAB Compiler

Hi, As part of an automated build script I want to build my Matlab code using the Matlab Compiler deploytool command: deploytool /build myproject.prj.
I get the folowing error:
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using '' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.access$200(Unknown Source) at sun.awt.X11GraphicsEnvironment$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at java.awt.GraphicsEnvironment.createGE(Unknown Source) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source) at sun.awt.X11.XToolkit.<clinit>(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at java.awt.Toolkit$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Unknown Source) at java.awt.Toolkit.getEventQueue(Unknown Source) at java.awt.EventQueue.isDispatchThread(Unknown Source) at java.awt.EventQueue.invokeAndWait(Unknown Source) at javax.swing.SwingUtilities.invokeAndWait(Unknown Source) at com.mathworks.toolbox.compiler.plugin.DeploytoolCommandLineParser.parse(DeploytoolCommandLineParser.java:73)
I use Matlab 2013b on Ubuntu. Running the same command from the Ubuntu UI terminal works fine (as opposed to running it from remote SSH). Trying to set the DISPLAY to :0 did not work.
BTW, The automated build is run using Bamboo script, so there might be a solution there as well.
Is there a way to run deploytool with 'nodisplay' switch? Any other ideas how to solve the issue?
Thanks! Guy.

Best Answer

I ended up using xvfb: http://en.wikipedia.org/wiki/Xvfb
Related Question