IKVM.NET_第七篇_用户指南_工具ikvm.exe

Ikvm工具是用.NET实现的Java虚拟机。本文内容如下:
1) 用法
2) 选项
3) 备注
4) 例子
+++ 用法
ikvm [ options ] classname [ args ... ]ikvm [ options ] -jar jarfile [ args ... ]
1) options是虚拟机的命令行选项。
2) classname是包含main方法的类名。不要包含路径或是类的扩展名。不要使用“-jar”选项。
3) jarfile是一个可执行jar文件的名字。只能使用“-jar选项”。
4) args是传递给main类的命令行参数。
+++ 选项
1) -cp classpath or -classpath classpath
Specifies the classpath for the JVM. classpath is a semicolon-delimited list of pathnames to directories and zip files / jar files.
为JVM规定classpath。Classpath后边的名字用逗号分隔。
Note: If you specify this option more than once, only the last is used.
2) -Dproperty-name=value
Set a system property named property-name to value. Note that there is no space between the -D and property-name. 
3) –Xsave
Saves the generated assembly (for debugging)
4) –Xtime
Times the execution 
5) -Xbootclasspath:classpath
Augments the boot classpath for the JVM. classpath is a semicolon-delimited list of pathnames to directories and jars. These classes are made available through the boot class loader in addition to those in the GNU Classpath libraries.
Note: If you specify this option more than once, only the last is used.
6) -Xtrace:name
Displays all tracepoints with the given name 
7) -Xmethodtrace:name
Builds method trace into the specified output method
8) -Xwait  Keeps process hanging around after exit
+++备注
这个应用程序扮演着SUM / IBM JVM的作用。在许多情况下,你可以使用Java命令行,或是用ikvm.exe来简单替代java。
ikvm查找类的方式如下:
+ 若没有规定-cp/-classpath 或 –jar选项,并且没有设置CLASSPATH环境变量,则在当前路径中查找。
+ 若没有规定-cp/-classpath 或 –jar选项,并且设置CLASSPATH环境变量,则在CLASSPATH中规定的路径查找(除非CLASSPATH中包含,否则不在当前路径中查找)。
+ 若规定-cp/-classpath选项,则忽略CLASSPATH环境变量,则仅仅在-cp/-classpath规定的路径中查找。
+ 若规定了-jar选项,则jar文件被前置到CLASSPATH中(或-cp/-classpath specified classpath)。
注意:这种查找方式与Sun JVM的方式是不同的。
+++例子
++ ikvm MyProg从当前目录装载名为MyProg.class的文件(unless the CLASSPATH environment variable is set, in which case that is searched instead),并且执行它的main方法。
ikvm -cp c:/java/lib;c:/mystuff/mylib.jar;c:/mystuff/otherlib.zip org.me.MyProg
++ 从MyProg.class文件中装载名为org.me.MyProg类,并且执行它的main方法。按下面方式搜索:
1) c:/java/lib/org/me/MyProg.class
2) c:/mystuff/mylib.jar (looks inside for org/me/MyProg.class)
3) c:/mystuff/otherlib.zip (looks inside for org/me/MyProg.class)
ikvm -jar /usr/share/myprog.jar
++ 在jar包/usr/share/myprog.jar中执行Java代码。

 

IKVM.NET Virtual Machine (ikvm.exe)
The ikvm tool is a Java virtual machine implemented in .NET.
1) Usage
2) Options
3) Notes
4) Examples
+++ Usage
ikvm [ options ] classname [ args ... ]ikvm [ options ] -jar jarfile [ args ... ]
1) options
Command-line options for the virtual machine.
2) classname
Fully-qualified name of a class containing the main method to execute. Do not include a path or a .class extension. Do not use this with the -jar option.
3) jarfile
The name of an executable .jar file to execute. Used only with the -jar option.
4) args
Command-line arguments passed to the main class.
+++ Options
1) -cp classpath or -classpath classpath
Specifies the classpath for the JVM. classpath is a semicolon-delimited list of pathnames to directories and zip files / jar files.
Note: If you specify this option more than once, only the last is used.
2) -Dproperty-name=value
Set a system property named property-name to value. Note that there is no space between the -D and property-name. 
3) –Xsave
Saves the generated assembly (for debugging)
4) –Xtime
Times the execution 
5) -Xbootclasspath:classpath
Augments the boot classpath for the JVM. classpath is a semicolon-delimited list of pathnames to directories and jars. These classes are made available through the boot class loader in addition to those in the GNU Classpath libraries.
Note: If you specify this option more than once, only the last is used.
6) -Xtrace:name
Displays all tracepoints with the given name 
7) -Xmethodtrace:name
Builds method trace into the specified output method
8) -Xwait Keeps process hanging around after exit
+++ Notes
This command is intended to act as a "drop-in" replacement for the Sun / IBM JVM's. In many cases, you can take a java command line and simply replace java with ikvm.
Please refer to the Sun documentation for usage details. Note that ikvm supports only the options listed here.
ikvm finds classes as follows:
+ If no -cp/-classpath or -jar option specified, and no CLASSPATH environment variable is set, looks in the current directory.
+ If no -cp/-classpath or -jar option specified, and CLASSPATH environment variable is set, looks in directories specified in CLASSPATH (not in the current directory unless CLASSPATH contains .).
+ If -cp/-classpath option specified, ignores CLASSPATH environment variable, and looks only in directories specified in -cp/-classpath option.
+ If -jar option specified, prepends jarfile to CLASSPATH (or -cp/-classpath specified classpath).
Note: This is different from the Sun JVM behavior.
For information about creating executable jar files, see this IBM article.
+++ Examples
++ ikvm MyProg Loads a class named MyProg.class from the current directory (unless the CLASSPATH environment variable is set, in which case that is searched instead) and executes its main method.
ikvm -cp c:/java/lib;c:/mystuff/mylib.jar;c:/mystuff/otherlib.zip org.me.MyProg
++ Loads a class named org.me.MyProg from a file named MyProg.class and executes its main method. Searches for it in the following locations:
1)  c:/java/lib/org/me/MyProg.class
2) c:/mystuff/mylib.jar (looks inside for org/me/MyProg.class)
3) c:/mystuff/otherlib.zip (looks inside for org/me/MyProg.class)
ikvm -jar /usr/share/myprog.jar
Executes Java code in the executable jar file /usr/share/myprog.jar.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值