1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "http://apache.org/forrest/ttd/document-v12.ttd">
<document>
<header>
<title>IKVM.NET Bytecode Compiler (ikvmc.exe)</title>
<abstract>The ikvmc tool converts Java bytecode to .NET dll's and exe's.</abstract>
</header>
<body>
<section>
<title>Usage</title>
<table><tr><td>
<p xml:space="preserve"> ikvmc [ <em>options</em> ] <em>classOrJarfile</em> [ <em>classOrJarfile ...</em> ]</p>
</td></tr></table>
<dl>
<dt>options</dt>
<dd>See below.</dd>
<dt>classOrJarfile</dt>
<dd>Name of a Java .class or .jar file. May contain wildcards (*.class).</dd>
</dl>
</section>
<section>
<title>Options</title>
<table>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
<tr>
<td>
-out:<em>outputfile</em>
</td>
<td>Specifies the name of the output file. Should have a .dll extension (if -target is library) or an .exe extension (if -target is exe or winexe).
In most cases, if you omit this option, ikvmc will choose an output name based on the -target and the
name of the input files. However, if you specify input files using wildcards, you must use
this option to specify the output file.</td>
</tr>
<tr>
<td>
-assembly:<em>assembly-name</em>
</td>
<td>
Specifies the name of the generated assembly. If omitted, the assembly name is (usually)
the output filename.
</td>
</tr>
<tr>
<td>
-target:<em>target-type</em>
</td>
<td>
Specifies whether to generate an .exe or .dll.
<em>target-type</em> is one of
<ul>
<li>exe - generates an executable that runs in a Windows command window</li>
<li>winexe - generates an .exe for GUI applications</li>
<li>library - generates a .dll</li>
<li>module - generates a .netmodule</li>
</ul>
<p>On Linux, there is no difference between <em>exe</em> and <em>winexe</em>.</p>
</td>
</tr>
<tr>
<td>
-keyfile:<em>keyfilename</em>
</td>
<td>
Uses <em>keyfilename</em> to sign the resulting assembly.
</td>
</tr>
<tr>
<td>
-version:M.m.b.r
</td>
<td>
Specifies the assembly version.
</td>
</tr>
<tr>
<td>
-main:<em>classname</em>
</td>
<td>
Specifies the name of the class containing the main method.
If omitted and the -target is exe or winexe, ikvmc searches
for a qualifying main method and reports if it finds one.
</td>
</tr>
<tr>
<td>
-reference:<em>library-filespec</em>
</td>
<td>
If your Java code uses .NET API's, specify the dll's using this
option. This option can appear more than once if more than one library is referenced.
Wildcards are permitted (e.g. c:\libs\*.dll).
</td>
</tr>
<tr>
<td>
-recurse:<em>filespec</em>
</td>
<td>
Processes all files matching <em>filespec</em> in and under the directory specified by
<em>filespec</em>. Example: -recurse:*.class
</td>
</tr>
<tr>
<td>
-nojni
</td>
<td>
Do not generate JNI stub for native methods
</td>
</tr>
<tr>
<td>
-resource:<em>name</em>=<em>path</em>
</td>
<td>
Includes <em>path</em> as a Java resource named <em>name</em>
</td>
</tr>
<tr>
<td>
-exclude:<em>filename</em>
</td>
<td>
<em>filename</em> is a file containing a list of classes to exclude
</td>
</tr>
<tr>
<td>
-debug
</td>
<td>
Generates debugging information in the output. Note that this is only helpful
if the .class files contain debug information (compiled with the javac -g option).
</td>
</tr>
<tr>
<td>
-srcpath:<em>path</em>
</td>
<td>
Specifies the location of source code. Use with -debug. The
package of the class is appended to the specified <em>path</em> to locate
the source code for the class.
</td>
</tr>
<tr>
<td>
-Xtrace:<em>name</em>
</td>
<td>
Displays all tracepoints with <em>name</em>
</td>
</tr>
<tr>
<td>
-Xmethodtrace:<em>methodname</em>
</td>
<td>
Builds method trace into the specified output method.
</td>
</tr>
</table>
</section>
<section>
<title>Notes</title>
<p>The ikvmc tool generates .NET assemblies from Java class files and jar files.
It converts the Java bytecodes in the input files to .NET CIL. Use it to produce</p>
<ul>
<li>.NET executables (-target:exe or -target:winexe)</li>
<li>.NET libraries (-target:library)</li>
<li>.NET modules (-target:module)</li>
</ul>
<p>Java applications often consist of a collection of jar files. ikvmc can process several input jar files (and class files)
and produce a single .NET executable or library. For example, an application consisting of main.jar, lib1.jar,
and lib2.jar can be converted to a single main.exe. </p>
<p>When processing multiple input jar files that contain duplicate classes / resources, ikvmc will use the first
class / resource it encounters, and ignore duplicates encountered in jars that appear later on the
command line. It will produce a warning in this case. Thus, order of jar files can be significant.</p>
<note>
When converting a Java application with ikvmc, for best results, list the jars on the ikvmc command
line in the same order that they appear in the Java application's classpath.</note>
</section>
<section>
<title>Examples</title>
<p xml:space="preserve"><code> ikvmc myProg.jar </code></p>
<p>Scans myprog.jar for a main method. If found, an .exe is produced; otherwise, a .dll is generated.
</p>
<p xml:space="preserve"><code> ikvmc -out:myapp.exe -main:org.anywhere.Main -recurse:bin\*.class lib\mylib.jar</code></p>
<p>Processes all .class files in and under the bin directory, and mylib.jar in the lib directory. Generates an executable
named myapp.exe using the class org.anywhere.Main as the main method.</p>
</section>
</body>
</document>
|