<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "http://apache.org/forrest/dtd/document-v12.dtd">
<document> 
  <header> 
    <title>IKVM.NET Concepts</title> 
    <authors><person name="Stephen Schaub" email="sschaub@bju.edu"/> 
    </authors> 
     <abstract>This section discusses several important concepts about
     the capabilities and limitations of IKVM.NET. </abstract>
  </header> 
  <body> 
    <section>
      <title>Class Loading</title>
      
      <p>IKVM.NET fully supports dynamic Java class loading, both in Java applications running in the ikvm 
      JVM, as well as in Java applications which have been converted to .NET CIL using ikvmc. 
      </p>
      
      <section>
        <title>Class Loading in Dynamically Interpreted Java Applications</title>
        <p>When you run a Java application using ikvm, ikvm finds and loads Java .class files much like
        other Java VM's. See the <link href="ext:ikvm">ikvm notes</link> for details.</p>
      </section>

      <section>
        <title>Class Loading in ikvmc-compiled Java Applications</title>
        <p>When you convert a Java application to CIL using ikvmc, it executes as "native" .NET code. Each .NET assembly will have its own
        Java class loader instance (typically of the type ikvm.runtime.AssemblyClassLoader). This class loader will load classes using the following algorithm:</p>
        <ol>
          <li>The corresponding assembly is searched first. Thus, if the class exists in the assembly, it will be found there.</li>
          <li>All assemblies directly referenced by corresponding assembly are searched.</li>
        </ol>

        <p>For more details see these two articles: <link href="http://weblog.ikvm.net/PermaLink.aspx?guid=4e0b7f7c-6f5d-42a3-a4d6-5d05a99c84ff">Class Loading Architecture</link>, <link href="http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68">Writing a Custom Assembly Class Loader</link></p>
        
      </section>
    
    </section>
    
    <section>
      <title>Debugging Support</title>
      <p>Java applications converted to CIL using ikvmc with the -debug option can be debugged using standard .NET / Mono debugging
      tools. Remember to compile the Java source code using the appropriate debug option (javac: -g or jikes: -g:lines,vars,source).</p>
    </section>
  </body>
</document>
