Java

From ENIGMA
Revision as of 20:03, 6 February 2013 by IsmAvatar (talk | contribs) (→‎DND freezing Bug)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Java is a powerful higher-level interpreted programming language. It has powerful Integrated development environments, such as Eclipse and NetBeans. Usually, code gets compiled into JVM Bytecode with the JDK (usually using javac), which then gets interpreted (or run) by the Java Virtual Machine with the JRE (usually using the java command) - in short, you compile the code, and then you run it, similar to other lower-level languages. Even though it is interpreted, much of the code still gets delegated to native functions, and others make direct hardware calls, making it oftentimes as fast as, or even faster than, completely compiled languages. Due to its interpreted nature, the bytecode is cross-platform compatible, being able to be run on any platform that has a JVM capable of interpreting the bytecode for that platform - which means that Java programs are cross-platform even after being compiled, unlike lower-level languages. Java is also known for their Swing graphical user interface API, which makes developing a cross-platform GUI very easy. For these reasons, Java was chosen as the language on which to develop LateralGM. Java is also entirely Object Oriented.

Java was originally developed and owned by Sun Microsystems, and was mostly open source. In 2006, Sun started the OpenJDK project as a completely free and open source implementation of the Java specification. During this time, LateralGM displayed and worked the best in the Sun JRE, and had some graphical glitches in OpenJDK. In 2009, Sun was acquired by the database giant Oracle. Since Oracle has no reputation for open source software, the OpenJDK project took off. Recent tests have shown that LateralGM now behaves and displays normally in OpenJDK. Some versions of Ubuntu/Xorg and Sun JRE also exhibit a bug causing the entire desktop to freeze, known as the #DND freezing Bug. Because of this, we recommend choosing OpenJDK over the Oracle/Sun JDK/JRE, if possible. Ubuntu usually comes pre-installed with OpenJDK.

Install JDK

Java 6 JDK can be obtained from the Linux repositories (you can use the Software Center) or its website (e.g. for windows users)

  • Software Center: search for JDK, usually under Developer Tools.
  • apt-get: sudo apt-get install default-jdk
  • pacman: pacman -Sy openjdk6
  • yum: sudo yum install default-jdk
  • Download the binaries: Oracle's Java JDK (you won't need FX, EE, or NetBeans).

Sometimes the repository only offers the JRE or JDK 5 or below (usually with older distro versions), in which case you can download from the website instead.

DND freezing Bug

A Java bug 6397447 appeared in LateralGM when a number of criterion are met:

  • Sun JRE or JDK (formerly recommended due to OpenJDK displaying some components of LateralGM very poorly, which has since been fixed).
  • A certain version of Xorg (usually packaged with Ubuntu)
  • The Java program must be in a jar (what LGM usually ships as)
  • The Java program must have a splash screen (LGM usually has a splash screen, since it takes a few seconds to load up)
  • The user initiates a Drag gesture on a draggable component in the Java program (Such as LGM's resource tree, or one of the DND Actions)

Whenever these 5 criterion were met, it would cause the entire desktop display to freeze, forcing you to either restart the desktop, or remotely terminate the offending application. To work around this bug, simply change any of the 5 criterion (change JRE, switch to different Xorg version, unjar LGM, remove the splash screen, or avoid/disable drag gestures). Because of this, it's clear that this is not an LGM bug, since the most LGM could do is either disable DND, disable the splash screen, or ship unjarred, none of which are entirely desirable. The bug has been reported on Xorg and Java bugtrackers, but they seemed to point the blame back and forth at each other. Java eventually accepted bug 6397447.

This bug was fixed in Sun Java 6 update 21. More details can be found in the link above. If you are experiencing this bug, either update to 6u21, or switch to OpenJDK.