TypeLoadException in C# form app with IKVM

240 views Asked by At

I have written a simple java class file i.e

package Test;
public class Message {
      public static String getMessage(String msg)
      {
          return "Hello "+msg;
      }
}

converted this .jar file to .dll using ikvmc then Referenced this "IkvmTest.dll" and IKVM.OpenJDK.Core in my C# form app which is like this

private void button1_Click(object sender, EventArgs e)
{
    textBox1.Text = Test.Message.getMessage("MyName");
}

But it is giving me error after clicking button as "Could not load type 'Test.Message' from assembly 'IkvmTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.":"Test.Message"

and interesting thing is that it worked perfectly in C# console app where java class file is

package Test;
public class Message {
      public static void getMessage(String msg)
      {
          System.out.println("Hello "+msg);
      }
}

Please help regarding form application.
Update: My problem is solved now. Actually the project name of java(IkvmTest.jar) and C# forms app(IkvmTest) was same hence name of generated .dll(IkvmTest.dll) from jar and C# app was conflicting. So just creating C# project with different name solved my problem.

0

There are 0 answers