MATLAB: Does the program crash when trying to run a deployable web application on a Solaris machine in MATLAB 7.6 (R2008a)

I have two systems, a PC that has MATLAB and JA Builder installed and a Solaris system that has Tomcat server and MCR running.The MCR is installed in a common network directory. The Solaris machine does not have a graphics card and a monitor and basically, it does not have display capabilities.
When I run my deployed web application on the Solaris machine with the X Server running on my PC, it runs fine but if the X Server is not running, my web application crashes.

Best Answer

This is most likely because the web server, i.e. the Solaris machine in this case, does not have a graphical subsystem (i.e. a graphics card and monitor). Basically, the system has a “Headless mode” configuration in which the display device, keyboard, or mouse is lacking.
Many methods in the “java.awt.Toolkit” and “java.awt.GraphicsEnvironment” classes, with the exception of fonts, imaging, and printing, require the availability of a display device, keyboard, and mouse. But some classes, such as Canvas or Panel, can be executed in headless mode.
By default, the Java Virtual Machine tries to use the hardware-based graphical capabilities of the machine to implement AWT. For servers without a graphical interface, the servers running any application using MCR will crash or will throw error messages. This is because the MCR uses Java's AWT (Abstract Window Toolkit) to implement a lot of its functionality.
Please follow the steps given below to resolve this issue:
1. Clear out an environment variable "DISPLAY" so that commands do not try to create a window. This can be done from the command line as follows:
unsetenv DISPLAY
2. Set the system property "java.awt.headless" to 'true' so that the JVM will implement AWT in software, rather than attempting to use non-existent hardware-based graphics as follows:
-Djava.awt.headless=true
Note: java.awt.headless is only available with JDK 1.4 and above. It is not available on previous versions of the JDK.
The information above has been taken from the following website:
<http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/>