2010-06-29 70 views

回答

2

我有類似的問題。在我的情況下,J3D jar文件可用,但不是平臺二進制文件。

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

我認爲這比以前更完整。聽起來像罐子是不夠的。 – javydreamercsw 2011-05-11 13:20:14

3

您可以嘗試從Java 3D API中加載一個類,並將您的邏輯放入catch語句中。即

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

我知道,我知道,例外不應該是預期的。

相關問題