Why the DLL generated from Java jar file doesn't show namespace

144 Views Asked by At

I need to use a java jar file in my c# (VS 2019) console application. OS is Windows 10.
I use ikvm-7.2.4630.5 and the dll file is generated without error. I added reference to dll and KVM.Open.JDK.Core.dll ,in C# application.
The issue happens when using “using ” keyword to import the package. I get the error "Type or namespace name cannot be found".

I did the following steps:

1)I wrote a test code to see if I can make it work.

Simple java class file:

package Msg;

public class MyMessage {

    public static void WelcomMsg(String msg) {
        System.out.println("Welcom " + msg);
    }

    public static void GoodByMsg(String msg) {
        System.out.println("Good Bye " + msg);
    }

}

2)The jar (msg.jar) file created in JavaSE-1.7 environment (using eclipse )

3)I can run either of these commands without error to generate dll (in folder ikvm-7.2.4630.5\\bin):

ikvmc -target:library -out:msg.dll -recurse:”./\*.jar

or

ikvmc -target:library msg.jar

--message after dll is generated ---------------
IKVM.NET Compiler version 7.2.4630.5
Copyright (C) 2002-2012 Jeroen Frijters
http://www.ikvm.net/

msg.dll is generated.

4)Added reference to msg.dll and IKVM.Open.JDK.Core.dll in C# console project (VS 2019).

5)"using" directive (using Msg;) generating error: Type or namespace name cannot be found

Basically the dll file seems empty.
Any help will be appreciated.

thanks

0

There are 0 best solutions below