Index: NativeJavaPackage.java
===================================================================
--- NativeJavaPackage.java	(revision 26)
+++ NativeJavaPackage.java	(working copy)
@@ -38,6 +38,7 @@
 package org.mozilla.javascript;
 
 import java.lang.reflect.*;
+import java.util.Hashtable;
 
 /**
  * This class reflects Java packages into the JavaScript environment.  We
@@ -67,6 +68,9 @@
         "java.text.resources",
         "java.applet",
     };
+    
+    // static cache to prevent excessive class loading
+    private static Hashtable cache = new Hashtable();
 
     public static Scriptable init(Scriptable scope)
         throws PropertyException
@@ -170,6 +174,12 @@
         String newPackage = packageName.length() == 0
                             ? name
                             : packageName + "." + name;
+
+	// check general cache before causing exceptions, ...
+        Object found = cache.get(newPackage);
+        if (found != null)
+            return found;    	
+
         Context cx = Context.getContext();
         SecuritySupport ss = cx.getSecuritySupport();
         Scriptable newValue;
@@ -200,6 +210,8 @@
             // Make it available for fast lookup and sharing of
             // lazily-reflected constructors and static members.
             super.put(name, start, newValue);
+            // fill general cache
+            cache.put(newPackage, newValue);
         }
         return newValue;
     }
