< prev index next >

src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java

Print this page

        

@@ -106,24 +106,21 @@
                 // If the bootstrap class loader fails, we try again with the
                 // application class loader.
                 ClassLoader cl = ClassLoader.getSystemClassLoader();
                 geCls = Class.forName(nm, true, cl);
             }
-            ge = (GraphicsEnvironment)geCls.newInstance();
+            ge = (GraphicsEnvironment)geCls.getConstructor().newInstance();
 //          long t1 = System.currentTimeMillis();
 //          System.out.println("GE creation took " + (t1-t0)+ "ms.");
             if (isHeadless()) {
                 ge = new HeadlessGraphicsEnvironment(ge);
             }
         } catch (ClassNotFoundException e) {
             throw new Error("Could not find class: "+nm);
-        } catch (InstantiationException e) {
+        } catch (ReflectiveOperationException | IllegalArgumentException e) {
             throw new Error("Could not instantiate Graphics Environment: "
                             + nm);
-        } catch (IllegalAccessException e) {
-            throw new Error ("Could not access Graphics Environment: "
-                             + nm);
         }
         return ge;
     }
 
     /**
< prev index next >