IKVM.NET_第九篇_开发者指南_概念

本文介绍一些IKVM.NET能力和限制的重要概念,内容如下:
1)加载字节码
2)支持调试
+++ 加载字节码
IKVM.NET完全支持在ikvm Java虚拟机上以及已经使用ikvmc应用程序转换成.NET 公共中间语言(CIL)的Java应用程序上动态加载Java字节码。
++ 动态地解释Java应用程序加载字节码
当你使用ikvm运行一个Java应用程序时,ikvm查找并加载Java字节码,就像任何Java虚拟机一样。
++ ikvmc编译的Java应用程序上加载字节码
当你使用ikvmc应用程序把一个Java应用程序转换成.NET公共中间语言(CIL)时,这个转换的代码作为“native”.NET代码执行。每个.NET装配(DLL文件)都将拥有它自己的Java字节码装载器实例,特别是ikvm.runtime.AssemblyClassLoader装载器。这个类装载器将通过下面方式装载类:
1) 首先查找相应的装配文件。若类在装配中,它就找到了。
2) 再搜索这个装配直接引用的装配。也就是这个DLL文件引用的其他DLL文件。
+++ 支持调试
使用ikvmc的“-debug”选项把Java应用程序转换成公共中间语言时,通过标准的.NET/Mono调试工具,可以调试该Java应用程序。

 

IKVM.NET Concepts
This section discusses several important concepts about the capabilities and limitations of IKVM.NET.
1) Class Loading
2) Debugging Support
+++ Class Loading
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.
++ Class Loading in Dynamically Interpreted Java Applications
When you run a Java application using ikvm, ikvm finds and loads Java .class files much like other Java VM's.
++ Class Loading in ikvmc-compiled Java Applications
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:
1) The corresponding assembly is searched first. Thus, if the class exists in the assembly, it will be found there.
2) All assemblies directly referenced by corresponding assembly are searched.
For more details see these two articles: Class Loading Architecture, Writing a Custom Assembly Class Loader
+++ Debugging Support
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).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值