# IKVM.NET Virtual Machine (ikvm.exe)

The ikvm tool is a Java virtual machine implemented in .NET.

- Usage
- Options
- Notes
- Examples

### Usage

ikvm [ options ] classname [ args ... ] ikvm [ options ] -jar jarfile [ args ... ]

options
  Command-line options for the virtual machine.
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.
jarfile
  The name of an executable .jar file to execute. Used only with the -jar option.
args
  Command-line arguments passed to the main class.

### Options

Option | Description
--- | ---
-cp classpath -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.
-Dproperty-name=value | Set a system property named property-name to value. Note that there is no space between the -D and property-name.
-Xsave | Saves the generated assembly (for debugging)
-Xtime | Times the execution
-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.
-Xtrace:name | Displays all tracepoints with the given name
-Xmethodtrace:name | Builds method trace into the specified output method
-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:

- c:\java\lib\org\me\MyProg.class
- c:\mystuff\mylib.jar (looks inside for org/me/MyProg.class)
- 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.

Send feedback about this page to webmaster@ikvm.net Copyright © 2008 Jeroen Frijters All rights reserved.