Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6434149

(cl) ClassLoader.loadClass() throws java.lang.ClassNotFoundException: [Ljava.lang.String; in JDK 6.0

XMLWordPrintable

    • 6
    • generic, x86, sparc
    • generic, linux, solaris_10, windows_xp

      Consider this simple test program:

        public class test {

            public static void main(String[] args) throws Exception {

                String[] s = new String[] { "123" };
                String clName = s.getClass().getName();
                test.class.getClassLoader().loadClass(clName);
            }
        }

      This runs fine on JDK 1.5, but throws this exception on JDK 6.0:

      Exception in thread "main" java.lang.ClassNotFoundException: [Ljava.lang.String;
              at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
              at test.main(test.java:7)

            mchung Mandy Chung (Inactive)
            jlueheorcl Jan Luehe (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: