Search code examples
javajava-3d

How can I check if Java 3D is installed from my java application?


How can I check if Java 3D is instaled on the client? I can use that to display a message about missing requirements. Thanks in advance!


Solution

  • I had a similar problem. In my case the J3D jar file was available but not the platform binaries.

    try
    {
       GraphicsConfigTemplate3D gconfigTemplate = new GraphicsConfigTemplate3D();
       GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(gconfigTemplate);
    }
    catch (Error e) // You shouldn't normally catch java.lang.Error... this is an exception
    {
       System.out.println("Java3D binaries not installed");
    }