ClassFormatError: Unknown constant tag in class XY
<p>I have a piece of code in which I try to load a class during runtime. The code is not all selfwritten so I have some problems understanding the error which always appers after compiling.</p>

<p>Here the code:</p>

<pre><code>private Class findClass(String s)
        throws ClassNotFoundException
    {
        URL url = getResource("AP.class");
        if(url == null)
        {
            throw new ClassNotFoundException(s);
        }
        inputstream = null;
        Class classToRead;
        try
        {
            inputstream = url.openStream();
            byte abyte0[] = readClass(inputstream);
            classToRead= defineClass(s, abyte0, 0, abyte0.length);
        }
        catch(IOException ioexception)
        {
            throw new ClassNotFoundException(s);
        }
        if(inputstream != null)
        {
            try
            {
                inputstream.close();
            }
            catch(Exception exception1) { }
        }
        return classToRead;
    }
</code></pre>

<p>The error appears at the defineClass method.</p>

<p>Error stacktrace:</p>

<pre><code>Exception in thread "main" java.lang.ClassFormatError: Unknown constant tag 63 in class file AP
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at c.findClass(c.java:100)
    at c.loadClass(c.java:56)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at c.a(c.java:20)
    at mainOpenClass.main(lol.java:13)
</code></pre>

<p>My questions now are:
Is maybe anything wrong with the code?
Is it possible that the AP.class is damaged?
What does the error really mean?</p>

<p>I hope anybody can help me with my problem because searching the internet didn't really help in that case.</p>
