From GPWiki
Jump to: navigation, search

Java's most important property is that programs are byte-compiled to a platform-independent format, which makes cross-platform programming very easy. All that is required is a Java Virtual Machine on the machine where the program is run. This causes a small amount of overhead compared to machine language compiled programs, but it is definitely possible to write realtime games in Java. This is made more possible by two factors: the Just In Time compilers and RTSJ (the Real Time Specification for Java).

In spite of the interpreter nature of Java, some Java-to-machine code compilers do exist. These compilers allow you to create an executable program from the Java source (instead of generating bytecodes to be interpreted). This obviously makes the program faster on execution, but not portable when compiled. Thus the popularity of the Just-In-Time (JIT) compilers for Java.

Of course, regardless of your choice of compiler, the source code will still remain portable. In this way you can compile in bytecode or platform-dependent or a mixture. One such compiler is the GNU Compiler for Java, part of the GNU Compiler Collection.