ikvmnet / ikvm

A Java Virtual Machine and Bytecode-to-IL Converter for .NET
Other
1.24k stars 116 forks source link

The namespace from imported jar doesn't exist #505

Closed NotroDev closed 6 months ago

NotroDev commented 6 months ago

I'm trying to use https://github.com/SkEditorTeam/SkAnalyzer in my example C# console app. My project file looks like this:

<ItemGroup>
  <PackageReference Include="IKVM" Version="8.7.5" />
</ItemGroup>

<ItemGroup>
    <IkvmReference Include="path\to\SkAnalyzer.jar">
    <AssemblyName>SkAnalyzer</AssemblyName>
    <AssemblyVersion>1.3</AssemblyVersion>
    </IkvmReference>
</ItemGroup>

And, what should I do next? I can't import me.glicz.skanalyzer namespace. Build works fine, it puts the SkAnalyzer.dll in the output folder, but I don't know how to use it.

java.lang namespace works, for example. Maybe i don't understand something? I can't find any documentation, and all the tutorials are pretty old and don't use the IkvmReference.

wasabii commented 6 months ago

Check the build output the first time, and you might see it attempting to convert stuff. And failing for some reason or another.

Or, if you've already built that JAR, check the cache directory for the log it left behind. Which should be your temp directory, in ikvm/cache/1

NotroDev commented 6 months ago

Check the build output the first time, and you might see it attempting to convert stuff. And failing for some reason or another.

Or, if you've already built that JAR, check the cache directory for the log it left behind. Which should be your temp directory, in ikvm/cache/1

Oh yeah, I have errors in there.

ERROR: warning IKVMC0101: Unable to compile class "me.glicz.skanalyzer.Main"
ERROR:     (class format error "61.0")

Can I somehow fix it?

wasabii commented 6 months ago

Not that, no, unless you own the code. IKVM only supports up to JDK8 which is class format version 52. If you own the code, you can compile it for JDK8.

NotroDev commented 6 months ago

Oh, okay. I don't know if it's possible to use Java 8 in this project, but we'll see. Thanks for your help!