Skip to content
Advertisement

Java: Graphics in Linux

Does X-Windows have to be installed on a Linux-box in order for Java to display fullscreen graphics?

Advertisement

Answer

Other answerers appear to assume that “full screen graphics in Java” necessarily means “a working implementation of AWT”. This is, of course, not necessarily true, as it is perfectly possible (some would even say desirable) to use Java without AWT.

Cairo is a 2D graphics rendering library that can be used from Java, and can also be used without X11. It looks at first glance as though it should be possible to configure it for this scenario. You’ll need to configure it to use OpenGL rendering, and provide a suitable non-X11 OpenGL implementation (e.g. MesaGL with the ‘fbdev’ device driver).

SDLJava is a Java port of the popular C SDL game development library. This also should be able to do what you ask for, although it doesn’t seem to have been updated since 2005 so if you have any problems with it support may not be forthcoming.

As an alternative, you could always use some fairly simple C code to open and configure the framebuffer, and then use JNI to return the memory-mapped framebuffer as a direct-mode ByteBuffer, so you can draw to it directly.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement