Powered by
JSPWiki v2.8.2
g2gp 17-01-2009
View PDF

Previous | Next | Contents

Section 3: Virtual Reality Methods and Techniques#

3.9 Java and Java 3D #

3.9.1 What is Java?

Java is an object-oriented programming language developed by Sun Microsystems (Sun) designed to be portable across multiple platforms. It achieves this portability by using the 'Java virtual machine' (nothing to do with virtual reality), the core component of the Java Runtime Environment (JRE). Software developers compile Java programs to be executed by the JRE rather than a specific operating system, which is the case for applications written in other programming languages. Thus Java developers rely on Sun Microsystems to create or license-out a virtual machine that will port the software across a number of operating systems.

The decision to include a JRE in the Netscape and Internet Explorer web-browsers was a major contributing factor in the rise in popularity of Java for use on the Internet. A web-browser that has a JRE incorporated into its program is known as a Java-enabled browser.

Unfortunately, Sun's ability to extend the capabilities of the Java language has outpaced the browser developers' willingness to update the JRE in their software. Since its introduction to the web, Sun has released several major upgrades to Java but Netscape and Internet Explorer only upgraded to Java version 1.1. The 'classic' Mac operating system includes the original version of Java and has never been upgraded, although Apple's latest operating system, MacOS X, now includes Java 2. To remedy the problem of Java outpacing other developments, Sun has introduced a JRE plug-in for web browsers, which allows users to run Java applications from their browsers or directly from their computers. As a result both Netscape and Microsoft have dropped JRE from their latest browsers.

Versions of Java up to version 1.2 (i.e. version 1.0 to 1.1.8) are generally known as 'Java 1'. Later versions (i.e. version 1.2 to 1.4.1) are generally known as 'Java 2'.

3.9.2 What is Java 3D?

Java 3D is an extension to the Java programming language that creates a connection between the JRE and a computer's 3-D graphics support. Several versions of Java 3D have been released by Sun.

Java 3D applications have some similarities with VRML viewers (see Section 3.7). The main difference is that Java 3D applications are compiled programs. Unlike VRML, the source files which make up a Java 3D world (the three-dimensional objects, textures, sounds and interactions) are compiled together with the viewer into an application that users can run on their computers.

3.9.3 How to view Java 3D worlds

Users can run Java 3D applications either in their web-browser or directly on their computers if they:

  • Install a compatible JRE plug-in; at present this means a JRE plug-in that is compatible with versions of Java that are more recent than version 1.2.1
  • Install a Java 3D JRE plug-in that is compatible with the graphics capabilities of the computer
  • Download a Java 3D application.

The process is complicated for users. Firstly, Java 3D applets will not work with Java-enabled browsers that do not have the version 1.2.1 JRE plus the Java 3D plug-in installed. Secondly, users must select and install versions of the JRE and the Java 3D plug-in that are compatible with each other. Finally, users are recommended to check the graphics capabilities of their computer before choosing between the Direct X or OpenGL versions of the Java 3D plug-in.

Java 3D applications can be run on Windows and Linux operating systems but cannot yet be run on Apple Macs, although it may become possible for the Mac OS X operating system in future.

3.9.4 What is needed to create Java 3D applications?

To create Java 3D applications developers need:

  • A Java development environment
  • A Java3D software developer's kit – which will incorporate both the JRE and the Java 3D plug-in.

Java and Java 3D can be written by hand using the Java and Java 3D Software Developer's Kits that are freely available from Sun. For an experienced computer programmer, this takes no financial investment other than the time taken to learn how to write the programming language and access to a computer. A number of tutorials are available on the World Wide Web from Sun and the Java 3D community web-sites. However, learning to develop robust applications could take a novice from six months to two years. Writing programs by hand is also time consuming and the process of finding errors and debugging the code can cause hours of frustration.

Another option is to use a development environment, such as Borland's JBuilder, to ease the process of writing and debugging the program code. The three-dimensional objects that will make up the world are often created using a graphics package (such as AutoCAD, 3D Studio Max or Lightwave 3D), the objects are then converted into Java 3D code using a loader.

Java 3D developers may start by creating a world using VRML as a development environment and then converting it into Java 3D using a VRML loader. However, Java 3D does not support all of the features of VRML. In future X3D and the Xj3D browser, being developed by the WEB3D Consortium with Sun, may offer an alternative method (see Section 3.8).

Java 3D applications are compiled programs, which means that Java 3D worlds are hard coded with the viewer. For developers this meant that Java 3D worlds could not be output to file, edited and relaunched. As a result, the development process involved working with the 3-D models and other files that comprise the world in their original file format. With adequate documentation, worlds could be reloaded into Java 3D. Recently, Sun released Java 3D Fly Through helper classes which will allow developers to output Java 3D models in j3f format files and should ease development. However, the best preservation strategy (see Section 6) is to maintain back-up copies of the original files with adequate documentation.

3.9.5 Why don't people like Java 3D?

There are several limitations to Java 3D. Java 3D applications typically run more slowly than some other VR viewers. Large VR models may not work, as Java implementations may limit the amount of memory that can be used. The Java 3D plug-in is not available for Apple Macs, so will not run on all computers.

Perhaps the main reason why users dislike Java 3D is that it is complicated to install. Two different plug-ins must be downloaded and, as the JRE and the Java 3D add-on are large files, this can take a long time for a user who is connected to the Internet via a 56k modem. Finally, having downloaded the files and installed the plug-ins, Java 3D does not offer the same interactivity as other VR software programs.

3.9.6 Why do people like Java 3D?

Java 3D allows developers to create VR applications on a relatively low budget that can be delivered across a number of platforms. The development tools are inexpensive or free. Developers can also make use of Sun's Java Web Start application to provide software updates to their users through the Internet.

These factors may make Java 3D more suitable for in-house work rather than web-delivery. In-house work allows the developers to control the delivery platform, but delivery over the web means that developers are dependent on the end-user's willingness to install plug-ins.

How to find out more

Most information about Java 3D is available from www.java.sun.com and at the Java 3D community site. The Java 3D community web-site includes lists of frequently asked questions (FAQs), tutorials and articles about Java 3D. Javaworld magazine (www.javaworld.com) includes a number of articles on Java 3D.


Sun do not currently make the source code available for Java 3D.

JRE plug-in from www.java.sun
Java 3D plug-in from www.java.sun
Java Software Developers Kit
Java 3D SDK
Borland JBuilder
File Loaders
Java 3D Fly Through

Previous | Next | Contents