Can a Java library compiled to a DLL be used in developing a WP7 application?

1.2k Views Asked by At

Is it possible to compile Java code into a DLL to be used in a Windows Phone 7 application?

I know it's possible to compile Java code into a jar and run IKVM.NET to convert that to a .NET DLL, but can that (.NET) DLL be used in a Windows Phone 7 application?

Thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

There may be ways of doing it, but it would be painful - many of the ports of the standard library classes won't be viable within WP7. (Even a lot of existing .NET code won't work under WP7 without tweaking - it depends on what you're trying to do.)

You'd be much better off either finding an existing port of whatever you're trying to use, or porting the Java code yourself. You'll end up with much more idiomatic .NET code that way, too.

2
On

No, IKVM is not supported on Windows Phone, and won't be, because it marshals unmanaged code, and emits IL in unsupported ways.

As Jon suggests, rewriting your Java library in C#, while targeting it the phone platform, is a much better idea.