How do I run a Java program?

Added by Christoph Kappel almost 7 years ago. Updated by Christoph Kappel almost 6 years ago.

Category: Programs Difficulty: Difficulty7
Assignee: - Due date:
Related issue: - Related Message: -
Related version: - Views: 4556
Valid: Valid


Java expects a certain behaviour (reparenting of client windows) of a window manager which is not part of any standard, therefore some Java programs just show a white canvas.

If this happens just try to start your program like this:

1 AWT_TOOLKIT=MToolkit program

This changes the default tookit of Java to MToolkit, which is known to work with non-reparenting windows managers like subtle. Depending on your OpenJDK version and your architecture this may either lead to a segmentation fault or your OpenJDK just has no support for MToolkit. In this case check if your distribution has applied a patch for this issue which allows something like this to change the default behaviour:


In case both doesn't work there is a third option: Java seems to use an internally hardcoded list of window managers that are non-reparenting, the suckless guys made a tool (wmname) to change the name of the wm.

Since r2520 subtle can do that for you, just enable the :wmname option.

Generally this problem is really long lasting, see here:


Note: Many problems only affect the JRE and can be avoided by using the OpenJDK.

Also available in: PDF