Java的类不能与IKVM编译的JAR文件中的资源能与、文件、资源、Java

2023-09-03 22:24:52 作者:我有孤單陪著我

推荐答案

我已经找到了解决方案。其实我发现,我做错了。首先,我已经转换的Java库这样的:

I've found the solution. Actually I've found where I did wrong. First I had converted java library like this:



    ikvmc first.jar -target:library -out:main.library.dll
    ikvmc second.jar -target:library -out:second.dll -r:main.library.dll
    ikvmc third.jar -target:library -out:third.dll -r:main.library.dll

然后我合并了所有这些DLL与ILMerge。这个问题是不是在合并的DLL。问题是在加载resorces。加载器的功能是在主库。第二和第三个库使用从主库这部分代码的功能。因此,加载函数仅检索它的JAR文件,该文件是first.jar。它不搜索其他罐子即使它们全部是在相同的合并的DLL。所以我改变了这样的我的转换脚本:

Then I had merged all these dlls with ILMerge. The problem wasn't in merging the dlls. The problem was in loading the resorces. The loader function is in main library. And the second and the third libraries use this loader function from main library. So the loader function searches for only its jar file that is first.jar. it doesn't search the other jars even if all of them is in the same merged dll. So I changed my convert script like this:



    ikvmc first.jar -target:library -out:merged.library.dll -sharedclassloader { second.jar } { third.jar }

因此​​,所有罐子合并这一行命令。虽然我没有使用ILMerge了。没有关于ikvmc帮助页sharedclassloader任何解释。我发现在此页面这样的解释。