Pergunta

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!

Foi útil?

Solução

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");
}

Outras dicas

You could try loading a class from the Java 3D API and put your logic in the catch statement. ie

try {
    Class.forName("javax.media.j3d.J3DBuffer")
}
catch(final ClassNotFoundException e) {
//Your logic here
}

I know, I know, exceptions should not be expected.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top