我们正在使用 IKVM 将我们的 *.jar 转换为 dll,我们使用该 dll 将我们的代码迁移到带有 Mono 的 C#。我们遇到了一个问题,尤其是当使用包含 JNI 调用expl JnativeHook的 jar 时,它会在我们尝试时出错要使用 IKVM 转换它,我已向作者报告错误如下:
I'm trying to use JnativeHook.jar library, its work for my java apllications, However:
Not: JnativeHook its a cross-platform containes 3 .dll depends on the OS when the java application is running (dynamic loading of *.dll)...
JnativeHook.jar containes also a package(demo) that containes a main classe, i have solved this problem by deleting this one, now i'm sure that will be converted to dll...
finally, when i try to convert this one to .dll i get this error:
C:\Users\marwen\Desktop\Kid protector\Tools and IDE\ikvmbin-7.2.4630.5\bin>ikvmc JNativeHook.jar
IKVM.NET Compiler version 7.2.4630.5
Copyright (C) 2002-2012 Jeroen Frijters
http://www.ikvm.net/
note IKVMC0002: Output file is "JNativeHook.dll"
*** INTERNAL COMPILER ERROR ***
PLEASE FILE A BUG REPORT FOR IKVM.NET WHEN YOU SEE THIS MESSAGE
System.UnauthorizedAccessException: L'accès au chemin d'accès 'C:\Users\marwen\Desktop\Kid protector\Tools and IDE\ikvmbin-7.2.4630.5\bin\JNativeHook.dll' est refusé.
à System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
à System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, Str
ing msgPath, Boolean bFromProxy)
à System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
à System.IO.FileStream..ctor(String path, FileMode mode)
à IKVM.Reflection.Writer.ModuleWriter.WriteModule(StrongNameKeyPair keyPair, Byte[] publicKey, ModuleBuilder moduleBuilder, PEFileKinds fileKind, PortableExecutableKinds portableExecutableKind, Ima
geFileMachine imageFileMachine, ResourceSection resources, Int32 entryPointToken, Stream stream)
à IKVM.Reflection.Emit.AssemblyBuilder.SaveImpl(String assemblyFileName, Stream streamOrNull, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
à IKVM.Reflection.Emit.AssemblyBuilder.Save(String assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
à IKVM.Internal.CompilerClassLoader.Save()
à IKVM.Internal.CompilerClassLoader.Compile(String runtimeAssembly, List`1 optionsList)
à IkvmcCompiler.Compile(String[] args)
à IkvmcCompiler.Main(String[] args)
来自作者的回应:
>Comment By: Jeroen Frijters (jfrijters)
Date: 2013-02-12 03:28
Message:
Thanks. Fixed in cvs. BTW, the error is because ikvmc can't write to
JNativeHook.dll (probably because you don't have write access to the
directory).
正如你所看到的,作者只用了几句话回应了我们,但没有给我们一个解决方案..
我理解的是嵌入式 Dll 会出错,实际上 IKVM 不知道如何使用它(在 JAR 中)......
有一些建议可以解决这个问题吗?PS:什么意思Fixed in cvs
?谢谢你。