Java System.IO.FileNotFoundException在使用Jni4net运行Bridge.LoadAndRegisterAssemblyFrom(文件arg0)时发生异常

Java System.IO.FileNotFoundException在使用Jni4net运行Bridge.LoadAndRegisterAssemblyFrom(文件arg0)时发生异常,java,filenotfoundexception,jni4net,Java,Filenotfoundexception,Jni4net,我试图制作一个Jni4net程序,作为Java数据库和C#应用程序之间的桥梁。在完成了Jni4net附带的一些示例之后,我尝试了以下内容。在他的程序运行时,我的程序完全遵循它,然后得到错误: System.IO.FileNotFoundException 我用代码尝试了几个小时,但没有任何进展。这是代码,我不认为我的方法有任何问题,文件TestOne.j4n.dll确实在位置FourthTest/TestOne.j4n.dll下。是方法Bridge.LoadAndRegisterAssembly

我试图制作一个Jni4net程序,作为Java数据库和C#应用程序之间的桥梁。在完成了Jni4net附带的一些示例之后,我尝试了以下内容。在他的程序运行时,我的程序完全遵循它,然后得到错误:

System.IO.FileNotFoundException

我用代码尝试了几个小时,但没有任何进展。这是代码,我不认为我的方法有任何问题,文件
TestOne.j4n.dll
确实在位置
FourthTest/TestOne.j4n.dll
下。是方法
Bridge.LoadAndRegisterAssemblyFrom
给了我错误

import java.io.File;
import java.io.IOException;

import net.sf.jni4net.Bridge;

public class WriteHejsan {
    public static void main(String[] args) throws IOException{
        try{
            Bridge.setVerbose(true);
            Bridge.init();
            Bridge.setDebug(true);
        //  File proxyAssemblyFile = new File("TestOne.j4n.dll");
        //  Bridge.LoadAndRegisterAssemblyFrom(proxyAssemblyFile);
        //  Bridge.LoadAndRegisterAssemblyFrom(new java.io.File("C:/Users/Nikolai/JNIworkspace/FourthTest/TestOne.j4n.dll"));

            Bridge.LoadAndRegisterAssemblyFrom(new java.io.File("TestOne.j4n.dll"));
        //  testone.TestClass.Name();
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
}
编辑:

我得到的完整错误信息是(瑞典语的某些部分)


我设法解决了这个问题,我不得不将我的c#程序TestOne.dll移动到与我用build.cmd创建的TestOne.j4n.dll相同的文件夹中,将
.dll
文件放在
WriteHejsan
类的项目目录中,尝试在文件名前面加上正斜杠,即/TestOne.jn4.dll。另外,我看到您已经对上述完整路径进行了注释。注释行是否正常?“/TestOne.jn4.dll”给出了相同的错误,否他们给出了相同的System.IO.FileNotFoundException错误转到文件“TestOne.jn4.dll”,右键单击属性复制其路径。粘贴该路径并执行。另外,检查文件的权限。属性中的路径是:C:\Users\Nikolai\JNIworkspace\FourthTest\TestOne.j4n.dll TestOne.jn4.dll的权限?如果是,我可以在哪里检查它?右键单击文件并转到属性时,可以检查文件权限。
loading core from C:/Windows/assembly/GAC_MSIL/jni4net.n-0.8.8.0/0.8.8.0__134a23405600bab4/jni4net.n-0.8.8.0.dll
loading jni4net.n-0.8.8.0, Version=0.8.8.0, Culture=neutral, PublicKeyToken=134a23405600bab4 from C:\Windows\assembly\GAC_MSIL\jni4net.n-0.8.8.0\0.8.8.0__134a23405600bab4\jni4net.n-0.8.8.0.dll
loaded jni4net.n-0.8.8.0, Version=0.8.8.0, Culture=neutral, PublicKeyToken=134a23405600bab4 from C:\Windows\assembly\GAC_MSIL\jni4net.n-0.8.8.0\0.8.8.0__134a23405600bab4\jni4net.n-0.8.8.0.dll
Initialized jni4net core
core loaded from C:/Windows/assembly/GAC_MSIL/jni4net.n-0.8.8.0/0.8.8.0__134a23405600bab4/jni4net.n-0.8.8.0.dll
clr.version         :v4.0.30319
clr.arch            :64bit
java.home           :C:\Program Files\Java\jre7
java.version        :1.7.0_67
sun.arch.data.model :64
loading TestOne.j4n, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null from C:\Users\Nikolai\JNIworkspace\FourthTest\TestOne.j4n.dll
System.IO.FileNotFoundException: Det går inte att läsa in filen eller sammansättningen TestOne, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null eller ett av dess beroenden. Det går inte att hitta filen.
Filnamn: TestOne, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
vid System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
vid System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
vid System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
vid System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
vid net.sf.jni4net.utils.Registry.GetClrWrapperAttribute(Type type)
vid net.sf.jni4net.utils.Registry.RegisterWrapper(Type wrapperType, RegistryRecord& record)
vid net.sf.jni4net.utils.Registry.RegisterType(Type type, Boolean bindJVM, JNIEnv env)
vid net.sf.jni4net.utils.Registry.RegisterAssembly(Assembly assembly, Boolean bindJVM)
vid net.sf.jni4net.Bridge.RegisterAssembly(Assembly assembly)
vid net.sf.jni4net.Bridge.LoadAndRegisterAssemblyFrom(File assemblyFile)
vid net.sf.jni4net.__Bridge.LoadAndRegisterAssemblyFrom3(IntPtr __envp, JniLocalHandle __class, JniLocalHandle assemblyFile)

VARN: Loggningen av sammansättningsbindningen är inaktiverad.
Du kan aktivera felloggning för sammansättningsbindningar genom att ange registervärdet [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) till 1.
Obs! Prestanda kan försämras något med felloggning för sammansättningsbindningar.
Du kan inaktivera funktionen genom att ta bort registervärdet [HKLM\Software\Microsoft\Fusion!EnableLog].

at net.sf.jni4net.Bridge.LoadAndRegisterAssemblyFrom(Native Method)
at WriteHejsan.main(WriteHejsan.java:17)