Menu

ClassNotFoundException

Small SQL

One of the most ask question in the IKVM mailing list is the java.lang.ClassNotFoundException like:

Exception in thread "main" java.lang.ClassNotFoundException: com.xyz.Xyz
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(AccessController.java:279)
    at java.security.AccessController.doPrivileged(AccessController.java:520)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:450)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:385)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:500)
    at IKVM.Internal.ClassLoaderWrapper.LoadClassImpl(Unknown Source)
    at IKVM.Internal.ClassLoaderWrapper.LoadClassByDottedNameFastImpl(Unknown Source)
    at IKVM.Internal.ClassLoaderWrapper.LoadClassByDottedName(Unknown Source)
    at IKVM.NativeCode.java.lang.Class.forName0(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:287)

This occur if you have do a mistake at compile time. There can the follow causes:

  1. You have forgot to compile a needed jar file to a dll. In this case you should have receive some IKVMC0105 error messages from ikvmc. Add the missing jar file to your ikvmc command line.
  2. The different dlls has no references to the other. A simple solution can be a sharedclassloader.
  3. Look at the ikvmc warnings for the class name which was not found.

If this not help then contact the mailing list. Your mail should include:

  • The ikvmc command line(s).
  • The name of the jar file which include the missing class.
  • The name of the jar file which include the class which call Class.forName. This can you see in the line under Class.forName.
  • The warnings from your ikvmc call.

Related

Wiki: ClassLoader
Wiki: FAQ
Wiki: Ikvmc_messages
Wiki: Tutorial

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.