Home > .net 2.0, .net 3.5, c#, Visual Studio 2005, Visual Studio 2008 > Basic tutorial on IVKM and Java in .NET

Basic tutorial on IVKM and Java in .NET

October 24, 2007

Okay, a quick overview of the lifecycle from a Java .java file to a .NET .dll and consuming it in a .NET application.  The team working on IVKM is simply brilliant—this was great!

Step #1 – Creating the Java source file.

Let’s say I have a simple Employee class in Java (screenshots are in Eclipse, your Java editor may vary).  Three simply properties and overriding the toString method to provide a nice, clean output.

Java Employee class example

Step #2 – Converting the Java class to a .NET Library.

After you’ve compiled, Eclipse (or javac) will generate a .class file out of your .java file.  This is usually located in your bin\%packageName% directory.

To compile the .class file to a .dll, use the IKVMC executable.

Compiling the Java to a .Net library.

Step #3 – Using the new .NET Library in a project.

Create or open a project and add a reference to your new library.  It should also add in the two IVMK libraries—GNU.Classpath and Runtime.

You’ll also need to add a using statement.  The using namespace will simply be the name of the package in Java.  I this case, it’s TiredStudent.

Adding the compiled libraries to the .net project.

Using the Employee object is as simple as it would be in .NET.  A few properties and then using the toString() (lowercase to in Java) to output the results to the web.

Using the class inside of a web project.

You’ll note that this is a very simplistic class; however, it’s excellent to see that work that goes into some of these Java projects (and in our organization’s case, upcoming Java projects) can be reused within the .NET environment—without redesigning/recoding existing logic.


Very cool and, thanks to open source—very free!

Note: As a side note, an odd finding.  Screen captures of Console (a sweet freeware command prompt I use for working with shell and PowerShell stuff) won’t show up unless you turn Alpha transparency off.  *sigh*

[Updated 12 Nov 2008: Fixed photos]
  1. Siva
    November 12, 2008 at 8:33 am

    Basic tutorial on IVKM and Java in .NET

    the eclipse images are not getting displayed
    pls re post the images

  2. November 12, 2008 at 8:44 am


    Updated; thanks. Didn’t realize those still had the old gallery’s URLs.

  3. Thomas
    February 8, 2009 at 9:27 am

    It’s not IVKM, it’s IKVM. That’s why I couldn’t find a website for them.
    Publishin a link would be useful, so here it is http://www.ikvm.net/

  1. October 24, 2007 at 3:24 pm
  2. November 6, 2007 at 7:35 am
Comments are closed.
%d bloggers like this: