ClassLoader.loadClass() Throws java.lang.ClassNotFoundException

(Doc ID 1385556.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Java SE JDK and JRE - Version 6 and later
Information in this document applies to any platform.


Let's assume the following snippet:

public class Test {
    public static void main(String[] args) throws ClassNotFoundException {
        Class c =  

During runtime, you get a ClassNotFoundException. In the example stack trace below, the significant strings are printed in bold:

Exception in thread "main" java.lang.ClassNotFoundException: [B
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at Test.main(

As can be seen, "byte[].class.getName()" returns "[B" which is the name of the byte array class represented by the byte[].class object, as a String. The byte array is just an example.  In practice, you can see any array name in the stack trace.  For example ...

Exception in thread "main" java.lang.ClassNotFoundException: [Cjava.lang.String;


Exception in thread "main" java.lang.ClassNotFoundException: [Ljava.lang.Byte;



You have upgraded from Java 5 or earlier to Java 6 or later.  In Java 5 there was no problem at all.


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms