GameSpawn Site Map
GameSpawn Update mailing list
Lee's Lessons

Java3D In A Browser


Here's the big article. This is the one that will be necessary for all the ones in the future. This article tells the reader how to get Java3D to run in a browser. This may not seem like a big deal but if the user is an avid Java3D programmer, then they know the problem. This is a constant headache for most of the developers out there as evidenced by the amount of questions posed about it on the Java3D email list. The solution I found is NOT elegant and is about the shortest I could make it. The solution is similar to what is commonly out there. The only way to possibly shorten it is to only get the JRE and not the JDK and only copy the necessary files to the JRE instead of the JRE and the JDK directories. Java3D usually wants to install to the jdk directory though so who knows. I did it to both directories to get it to work and this alone took me about 7 hours to get working. Once you get it working it takes about 982734 hours to get just one applet to load and its performance under a browser is horrible. I recommend still using a Java application but it was asked of me to get this working in a browser so I did. This works in both Netscape and IE.

Knowing that this is a problem, here is the solution in as easy a format as I could make it:

  1. Download and install the JDK1.2 or above. Install to the default directory. This should also install the Java Plugin 1.2 in but if not you can get it here.

  2. Download Java3D. Install it into the default directory. Copy the bin from the Java3D install directory (c:\jdk1.2.2\jre\bin) to the Plugin directory (c:\program files\javasoft\jre\1.3\bin) and jdk directory (c:\jdk1.2.2\bin).

  3. Extract all the .jar files in the c:\jdk1.2.2\jre\lib\ext directory to the c:\jdk1.2.2\lib and c:\program files\javasoft\jre\1.3\lib directories.

  4. Edit your autoexec.bat to include the line
    set classpath=.;c:\"Program Files"\JavaSoft\JRE\1.2\lib

  5. Reboot

  6. Go to control panel, start the Java Plug in, select the Advanced Tab, click the drop down box under Java Run Time Environment and choose the one under c:\program files\javasoft\jre\1.2\bin.

  7. Reboot

  8. Download and install the HTML Converter.

  9. Run the HTML Converter and convert your .html file with the applet using the tool. Your original file can load the Java3D program like a standard applet and HTML Converter will add the appropriate code to update the browser to use Java3D. HTML Converter was run on this page to get the example below to work.

  10. Go make a sandwich cuz it takes like 18 hours to load one applet.

In this demonstration I just use the BasicBehavior from a previous example.


Michael C. Lee, Jr.