Areas
  • J3D FAQ
  • Tutorials
  • Utilities
  • Books
  • News
  • Other Sites
  • FAQ Topics
  • Introduction to Java 3D
  • Documentation
  • Speed issues
  • Running Java 3D
  • Object manipulation
  • Scene appearance
  • Java 3D and Swing
  • Image capturing
  • Stereo viewing
  • Input Devices
  • Textures
  • Web browsers
  • Video Hardware
  • VRML
  •   

    Running Java 3D

    1. Requirements and getting Java 3D installed and running

    2. Inability to find javax.media.j3d.*, com.sun.j3d.utils or javax.vecmath

    3. Exceptions

    4. The "no J3D in shared library path" error

    5. Strange rendering results

    6. Out of memory problems

    7. I have an XYZ Video Card. Why is it so slow?

    8. Can I run Java 3D under JDK 1.1?

    9. Using Java 3D with Symantec Visual Cafe

    10. Java 3D in fullscreen mode

    11. Where can I get the source to javax.media.j3d and javax.vecmath?

    Return to the main FAQ page for more questions and answers.

      

    1. Requirements and getting Java 3D installed and running

    First, download Java 3D 1.1 from the java.sun.com

    You must be running Java 2 for Java 3D to work correctly.

    For windows, you should be running the Java 2 (JDK 1.2) Windows 95/98/NT Production release.

    For Solaris, you should run the Java 2 (JDK 1.2) Solaris Production Implementation.

    You also need OpenGL support on your system to run Java 3D. If you are using Windows95/NT or Windows NT, you can get the OpenGL libraries from ftp://ftp.microsoft.com/softlib/mslfiles/opengl95.exe . It will not run using Win32s. Implementations for OpenGL and Direct3D are available.

    If you are using Solaris, you can download the files from http://www.sun.com/solaris/opengl . You must use OpenGL 1.1.1 with patch 106022-03 or later.

    Most importantly, follow all the instructions included in the Java3D download to set everything up. Once you've done all of that, try compiling and running some of the examples included in the archive.

    No other implementations of Java 3D are currently available.

    Back to top

    2. Inability to find javax.media.j3d.*, com.sun.j3d.utils or javax.vecmath

    Normally you will only find these errors when running under Java Plugin. There is a known bug with Java Plugin with JDK 1.2 and 1.2.1 that causes the JAR files to be not found and causes the above exceptions

    To fix this, you need to copy the JAR files from $jre.home/lib/ext to $jre.home/lib. Now your application will find the classes. Note that this effects anything installed as a standard extension, not just Java 3D.

    It is expected that a fix for this will be available with JDK 1.2.2.

    Back to top

    3. Exceptions

    If you think you've set everything up correctly, but are still having problems, check the list of exceptions stack traces I've compiled to see the likely cause and its solution.

    Back to top

    4. The "no J3D in shared library path" error

    Java3D should automatically install itself in the correct places so that it will always find the classes. Unfortunately, sometimes this doesn't work because something else might be screwed up - such as OpenGL.

    When installing J3D make sure that you give it the correct path for the JRE home. If you do not, then the system is unlikely to find the correct classes in your classpath. To check, look in the directory $JAVA_HOME/jre/lib/ext. In there you should find the following JAR files:

    j3daudio.jar
    j3dcore.jar
    j3dutils.jar
    vecmath.jar

    If you are missing any of these, you may generate the error message.

    For solaris users, David Thompson (davidt@chaos.lanl.gov) has posted the following hint:

    It turns out that though the Creator software was
    properly installed, the OpenGL software was not. To
    check for the proper installation of the graphics
    packages on Solaris, see the web page:
    

    http://www.sun.com/software/graphics/OpenGL/Developer/verify_install.html#Verif-OGL

    If you see nothing is returned by the check of openGL, you need
    to go through the install proceedure. Go to the web page:
    

    http://www.sun.com/software/graphics/OpenGL/1.1.2/dload_mailer.cgi

    and download and install openGL. (See instructions on the web pg)
    
    Next, restart your window server. (This can be done by logging
    out and then back in.)
    
    Then try to run the examples again and see if they work.
    
    Another useful page, if there is a problem, is:
    

    http://www.sun.com/software/graphics/OpenGL/Developer/FAQ-1.1.2.html

    Back to top

    5. Strange rendering results

    If you're running under Solaris, check to be sure you're running OpenGL 1.1.1 with patch level 106022-03 or later. Java 3D requires OpenGL 1.1.1 under Solaris, and the patch corrects a rendering bug in vertex arrays, which is something Java 3D utilitizes.

    If you're running under Windows, be sure that your display is set to at least 64K colors (more if possible).

    Back to top

    6. Out of memory problems

    If you get an error message about your Java 3D program (or any Java program for that matter). The Java virtual machine allocates a certain amount of memory to use, and it's much less than people typically have on their systems. To increase this limit, use the -Xmx option when you run the program. For example, the command:

     java -Xmx64m program 
    will allocate 64 meg of memory space.

    Back to top

    7. I have an XYZ Video Card. Why is it so slow?

    Many video cards designed for PC systems are designed for game playing. These cards only work in fullscreen mode (for example cards based on the Voodoo chipsets). That is, they do not provide hardware accelaration for 3D graphics when it is running in a window. When this happens, the underlying rendering API defaults to a software rendered mode making it much slower. Since Java3D only operates in windowed mode (see How Do I run J3D in Fullscreen Mode) you will never have hardware accelaration with your video card.

    The solution is to purchase a card that supports windowed hardware accelaration. Generally, any card with full OpenGL hardware support will offer this (particularly cards based on 3DLabs chipsets eg Permedia 2).

    Check the video card section of this FAQ for more information about video cards.

    Back to top

    8. Can I run Java 3D under JDK 1.1?

    No. Java 3D requires the use of a number of Java 2 specific features in order to run that cannot be removed.

    More specifically: Java 3D uses the GraphicsConfiguration classes to get screen information to decide how to do the hardware/software rendering. Java 1.1 does not provide this therefore no implementation of Java 3D will ever run on Java 1.1.

    Back to top

    9. Using Java 3D with Symantec Visual Cafe

    Scott Eberline (scott.eberline@anisci.com suggests the following:

    Symantec Visual Cafe Professional 3.0a can debug Java 3D applications.
    This note describes what I did to get it working.
    
    
    1. Installation Locations
    
    The steps below assume that Java is installed in the following
    directories.
    
            d:/JavaSoft/JRE/1.2/bin/...
            d:/JavaSoft/JRE/1.2/lib/...
    
            d:/JavaSoft/jdk1.2.1/bin/...
            d:/JavaSoft/jdk1.2.1/jre/...
            d:/JavaSoft/jdk1.2.1/lib/...
    
    Note that the JRE hierarchy contains both JRE 2 and the J3D runtime.
    Similarly, the JDK hierarchy contains both JDK 1.2.1 and the J3D SDK.
    
    
    2a. PATH Environment Variable
    
    My PATH is as follows. It is important that the JDK bin directory
    appear before the NT system32 directory, which probably contains
    some (half crippled) java.exe file.
    
            d:/JavaSoft/jdk1.2.1/bin
            c:/WINNT/system32
            c:/WINNT
            c:/VisualCafe/bin
            c:/VisualCafe/Java/bin
    
    
    2b. CLASSPATH Environment Variable
    
    My CLASSPATH is pretty minimal. Everything that properly belongs
    in the JRE lib/ext folder will be found there automatically by
    the JVM. (Cafe will need to be told explicitly where to locate
    those other jars, but not through CLASSPATH.)
    My CLASSPATH therefore only contains directories specific to
    my application; for this example, assume it to be unset.
    
    This is probably a good point to try J3D HelloUniverse.
    
    
    3a. Configuring Cafe Project Options
    
    Under Project Options, Directories tab, the directory list for
    "Input class files" needs to contain the following directories:
    
            d:\JavaSoft\jdk1.2.1\jre\lib
            d:\JavaSoft\jdk1.2.1\jre\lib\ext
    
    
    3b. Configuring Cafe Environment Options
    
    This is the important part. You must define a new VM to plug into Cafe.
    First, look at the Cafe readme (e.g. c:/VisualCafe/ReadMe.html),
    under the topic "Enhanced Pluggable VM Debugging Support for 3.0a".
    I've defined a VM called JDK 1.2.1, as follows:
    
            Compiler classpath        {see below}
            Use VM executable         D:/JavaSoft/jdk1.2.1/bin/java.exe
            Classpath specifier       -classpath
            Classpath                 {see below}
            Other command options     {empty}
            VM path                   D:/JavaSoft/jdk1.2.1/bin/
            Use debugger executable   {empty}
            Javadoc executable        {empty}
    
    The entries for "Compiler classpath" and "Classpath" are identical.
    Jar files to include in searchpaths for the compiler, VM and debugger:
    
            d:/JavaSoft/jdk1.2.1/lib/dt.jar
            d:/JavaSoft/jdk1.2.1/lib/tools.jar
            d:/JavaSoft/jdk1.2.1/jre/lib/i18n.jar
            d:/JavaSoft/jdk1.2.1/jre/lib/jaws.jar
            d:/JavaSoft/jdk1.2.1/jre/lib/rt.jar
            d:/JavaSoft/jdk1.2.1/jre/lib/ext/iiimp.jar
            d:/JavaSoft/jdk1.2.1/jre/lib/ext/j3daudio.jar
            d:/JavaSoft/jdk1.2.1/jre/lib/ext/j3dcore.jar
            d:/JavaSoft/jdk1.2.1/jre/lib/ext/j3dutils.jar
            d:/JavaSoft/jdk1.2.1/jre/lib/ext/vecmath.jar
    
    plus the Visual Cafe jars. The total Cafe JDK 1.2.1 classpath is this:
    
    .;
    d:\JavaSoft\jdk1.2.1\lib\dt.jar;
    d:\JavaSoft\jdk1.2.1\lib\tools.jar;
    d:\JavaSoft\jdk1.2.1\jre\lib\i18n.jar;
    d:\JavaSoft\jdk1.2.1\jre\lib\jaws.jar;
    d:\JavaSoft\jdk1.2.1\jre\lib\rt.jar;
    d:\JavaSoft\jdk1.2.1\jre\lib\ext\iiimp.jar;
    d:\JavaSoft\jdk1.2.1\jre\lib\ext\j3daudio.jar;
    d:\JavaSoft\jdk1.2.1\jre\lib\ext\j3dcore.jar;
    d:\JavaSoft\jdk1.2.1\jre\lib\ext\j3dutils.jar;
    d:\JavaSoft\jdk1.2.1\jre\lib\ext\vecmath.jar;
    C:\VisualCafe\JAVA\LIB;
    C:\VisualCafe\JAVA\LIB\SYMCLASS.ZIP;
    C:\VisualCafe\JFC\SWINGALL.JAR;
    C:\VisualCafe\Bin\COMPONENTS\SFC.JAR;
    C:\VisualCafe\Bin\COMPONENTS\SYMBEANS.JAR;
    C:\VisualCafe\JAVA\LIB\Collections.zip;
    C:\VisualCafe\JAVA\LIB\icebrowserbean.jar;
    C:\VisualCafe\JAVA\LIB\jsdk.jar;
    C:\VisualCafe\JAVA\LIB\SYMTOOLS.JAR
    
    If you shutdown Cafe and restart it, it may parse everything in the
    classpath and place a .vep file in your JDK bin directory.
    This is normal and expected.
    
    
    That's it. Good luck.
    
    
    Regards,
    --
    Scott D. Eberline | Project Manager-Developer | Animation Science Corp.
    

    Back to top

    10. Java 3D in fullscreen mode

    For DirectX 6.1, you can set the Java property, j3d.fullscreen to one of the following values:

    For instance, to run the HelloUniverse example program in fullscreen mode if it is available, the following command would be used:

     java -Dj3d.fullscreen=preFERRED HelloUniverse 

    For OpenGL, there is a workaround to make J3D look like it is operating in fullscreen by subclassing java.awt.Window. Essentially you create a new window instance that is exactly the same size as the current screen size. Window does not have all the borders that you normally get with Frame and Dialog.

      Toolkit tk = Toolkit.getDefaultToolkit();
      Dimension d = tk.getScreenSize();
      Frame f = new Frame();
      Window w = new Window(f);
      w.setSize(d);
      Canvas3D canvas = new Canvas3D();
      w.add(canvas);
      w.setVisible(true);
    

    Back to top

    11. Where can I get the source to javax.media.j3d and javax.vecmath?

    You cannot obtain source for the core Java 3D implementation as provided by Sun or the licensees. There are a number of unofficial implementations of the vecmath library, but none of the rendering class that we are aware of.

    Back to top

      

    [ Copyright Info ] [ FAQ Home ] [ J3D.org Home ] [ Tutorials ] [ Utilities ] [ Books ] [ Contact Us ]