3.7. Install Java 3D (optional)

If you already have a Java Software Development Kit (JSDK) or Java Runtime Environment (JRE) installed, then you can skip parts of this section. If you are using a JRE only, you'll have to get the JRE version of the Java 3D package and adapt these instructions.

It is recommended that you have the lastest version of Netscape, which at this time of writing is 6.2.1, if you plan to install the Java PlugIn for netscape. It works, but you may (or may not) experience Segmentation Faults when leaving a page that contained a Java 3D applet. KDE Konqueror can also be used to view Java 3D applets.

If you have not installed the Java SDK yet, you should have downloaded it already at least. Installing the JSDK is simple. You should follow the instructions that comes with it or follow my example below, based on using the Sun download.
			# The Sun download is a type of binary shell archive (man shar).
			# Make it executable and run it to unpack its contents
			chmod 744 j2sdk-1_3_1_02-linux-i386.bin
			./j2sdk-1_3_1_02-linux-i386.bin
			mv jdk1.3.1_02 /usr/local
			cd /usr/local
			ln -s jdk1.3.1_02 jdk
		

Next is to unpack Java 3D and finish setting up the environment for the Java SDK.
	cd jdk
	tar -xvyf ~/java3d-1.2.1_01-fcs-linux-i386-sdk.tar.bz2
	cd jre/lib/ext
	cp j3d* ..
	cp vecmath.jar ..
	cd /usr/local
	chown -R root:root jdk1.3.1_02
        

Edit /etc/profile or, as on many systems, you can add a new file like java.sh to the directory /etc/profile.d/. To either file, add:
			JAVA_HOME=/usr/local/jdk
			PATH=$PATH:$JAVA_HOME/bin
			MANPATH=$MANPATH:$JAVA_HOME/man
			export JAVA_HOME PATH MANPATH
        
If you used a separate file java.sh, remember to make it executable. Start a new login terminal for these changes to take affect.

This completes the installation of the Java 2 SDK, which includes the JRE and the Java 3D extension.

You can install the Java PlugIn for netscape:
	# go to where netscape is installed
	cd $MOZILLA_HOME
	cd plugins
	ln -s /usr/local/jdk/jre/plugin/i386/ns600/libjavaplugin_oji.so libjavaplugin_oji.so
	# This installs it globally for all users
	# Each user can run ControlPanel to customize the Java Plugin preferences.
	ControlPanel
	# Then try it out:
	netscape &
        
When netscape loads, go to Edit+Preferences->Advanced and Enable Java and Enable Java Plugin, then exit Netscape.

Test Java 3D demos:

                cd $JAVA_HOME/demo/java3d/GearTest
                java GearBox &
                # runs as normal java application
                netscape GearBox_plugin.html &
                # runs in netscape as an applet
        

If you experience trouble with Java, you can try deleting ~/.java and related files in your home directory, then try again. These files left over from a prior Java installation can cause problems.

If all works well, you should have a complete Java Developement and Runtime Environment for both normal apps and high-performance 3D apps. See http://java.sun.com/ for further information about Java and the Java 3D extension.