Using Java Jar or Class File in ASP.Net/ Convert Jar to dll
Well, the answer can be complicated or it can be simple too.
Complicated - This way would be to deal with interops. You would have to load the JVM and then interop the java calls across.
Simple way - Use ikvm.net. Using ikvm we can convert java/jar file to a .net dll. And well then it’s all good and easy.
IKVM is a free tool and has a bunch of other Java-.Net related support.
How It Works:
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
- .NET executables (-target:exe or -target:winexe)
- .NET libraries (-target:library)
- .NET modules (-target:module)
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.