Launching MATLAB Without the Java Desktop

At the moment we are very busy with the calculation of recurrence plots in the working group. One of my doctoral students complained that his MATLAB installation often crashes due to Java problems after the calculation has been running for a while. Of course you can try to solve the Java problems. On the other hand, you can also completely avoid the MATLAB user interface. Here is how.

There are a number of ways to launch MATLAB. The standard way to do this is to double-click on the MATLAB icon. If you do not like the MATLAB desktop, maybe also do not like the editor, you can run MATLAB without these tools.

I am a Mac user since the mid 80s, actually used an Apple IIe at school in the early 80s. In the late 90s Apple, before Steve Jobs returned and changed the whole story, Macs were not very popular and MathWorks decided to leave the Mac. I got a Sun workstation, actually a Sun Ultra 10, which was my first contact with the UNIX world. And I loved it. I still used my Mac to write text, to edit graphics and to browse the internet. The workstation was used to use MATLAB.

At that time I used the Terminal to run MATLAB without desktop and Emacs as the editor, using a configuration file available in the File Exchange to use syntax highlighting of MATLAB in Emacs. The advantage of this setup is that you can use it from your Mac, logging on to your Sun and running MATLAB on the Sun workstation. When Apple released Mac OS X in 2001, MathWorks quickly returned to the Mac with a UNIX-based version of MATLAB, which was great. I got a more powerful Mac and gave away the SUN workstation.

Today, while using a 12-core Mac Pro with maximum RAM in my office, I can still use MATLAB without desktop if necessary, either because I do not want to use the desktop for some reason or if I work remotely on that machine. After launching the Termination app on my Mac I can logon to my computer and change the directory to the one where MATLAB lives:

cd /Applications/

There you can launch MATLAB either by typing

./matlab -nojvm

after the Terminal’s prompt, which starts MATLAB without the Sun Microsystems JVM software, where JVM stands for Java Virtual Machine. Using this way of launching MATLAB will not allow you do display any graphics but will help you to avoid any Java-related problems on your computer. Alternatively you can launch MATLAB by typing

./matlab -nodesktop

which will start MATLAB without bringing up the desktop but it will start the JVM software. This means that you can use the development environment tools of MATLAB by typing their names after the MATLAB prompt and you can display your results in figure windows.

I like the free editor TextWrangler by Bare Bones Software Inc., available for Macs through the Mac App Store. If you google “TextWrangler MATLAB” you will find the MATLAB Language Module for color highlightning, for instance on this webpage. After having launched both MATLAB and TextWrangler, you run your scripts after editing simply by typing the filename after the prompt:


Depending on whether you used -nojvm or -nodesktop, you will get the numerical results in the MATLAB workspace or you will also get figure windows popping up and displaying your results. For more information about the various ways of launching MATLAB on your computer please read the doc pages MATLAB > Desktop Environment > Startup and Shutdown where you will find the sections starting with “Start MATLAB on … Platforms” for the Windows, Mac and Linux operating systems.