C#调用java包,报错:“java.lang.StdIO”的类型初始值设定项引发异常
求救:
我在C#里调用java包,
引用到:
IKVM.OpenJDK.Core.dll
IKVM.Runtime.dll
IKVM.Runtime.JNI.dll
还有一个打包好的java包:WsRequestDemo.dll
但是在使用时跳出错误:“java.lang.StdIO”的类型初始值设定项引发异常
具体为:
未处理 System.TypeInitializationException
Message="“java.lang.StdIO”的类型初始值设定项引发异常。"
Source="IKVM.OpenJDK.Core"
TypeName="java.lang.StdIO"
StackTrace:
在 java.lang.System.get_out()
在 java.lang.Class$3.run()
在 java.lang.Class$3.run()
在 java.security.AccessController.doPrivileged(Object , AccessControlContext , CallerID )
在 java.security.AccessController.doPrivileged(PrivilegedAction action, CallerID )
在 java.lang.Class.checkInitted()
在 java.lang.Class.privateGetDeclaredConstructors(Boolean )
在 java.lang.Class.getConstructor0(Class[] , Int32 )
在 java.lang.Class.newInstance0(CallerID )
在 java.lang.Class.newInstance(CallerID )
在 sun.security.jca.ProviderConfig$2.run()
在 sun.security.jca.ProviderConfig$2.run()
在 java.security.AccessController.doPrivileged(Object , AccessControlContext , CallerID )
在 java.security.AccessController.doPrivileged(PrivilegedAction action, CallerID )
在 sun.security.jca.ProviderConfig.doLoadProvider()
在 sun.security.jca.ProviderConfig.getProvider()
在 sun.security.jca.ProviderList.getProvider(Int32 )
在 sun.security.jca.ProviderList.getService(String type, String name)
在 sun.security.jca.GetInstance.getInstance(String type, Class clazz, String algorithm)
在 java.security.Security.getImpl(String , String , String )
在 java.security.MessageDigest.getInstance(String algorithm)
在 com.zht.WsRequestDemo.getMessageDigest(String str1, String str2)
在 WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) 位置 C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:行号 28
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.Run(Form mainForm)
在 WindowsFormsApplication1.Program.Main() 位置 C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\projects\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs:行号 18
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IO.FileNotFoundException
Message="未能加载文件或程序集“IKVM.OpenJDK.Util, Version=7.2.4630.5, Culture=neutral, PublicKeyToken=13235d27fcbfff58”或它的某一个依赖项。系统找不到指定的文件。"
Source="IKVM.OpenJDK.Core"
FileName="IKVM.OpenJDK.Util, Version=7.2.4630.5, Culture=neutral, PublicKeyToken=13235d27fcbfff58"
FusionLog="=== 预绑定状态信息 ===\r\n日志: 用户 = VSTFS\\Administrator\r\n日志: DisplayName = IKVM.OpenJDK.Util, Version=7.2.4630.5, Culture=neutral, PublicKeyToken=13235d27fcbfff58\n (Fully-specified)\r\n日志: Appbase = file:///C:/Documents and Settings/Administrator/My Documents/Visual Studio 2008/projects/WindowsFormsApplication1/WindowsFormsApplication1/bin/Debug/\r\n日志: 初始 PrivatePath = NULL\r\n调用程序集: IKVM.OpenJDK.Core, Version=7.2.4630.5, Culture=neutral, PublicKeyToken=13235d27fcbfff58。\r\n===\r\n日志: 此绑定从 default 加载上下文开始。\r\n日志: 未找到应用程序配置文件。\r\n日志: 使用 C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config 的计算机配置文件。\r\n日志: 策略后引用: IKVM.OpenJDK.Util, Version=7.2.4630.5, Culture=neutral, PublicKeyToken=13235d27fcbfff58\r\n日志: 相同的绑定已出现过,因 hr = 0x80070002 而失败。\r\n"
StackTrace:
在 sun.misc.URLClassPath.JarLoader.ensureOpen()
在 sun.misc.URLClassPath.JarLoader..ctor(URL , URLStreamHandler , HashMap )
在 sun.misc.URLClassPath$3.run()
在 sun.misc.URLClassPath$3.run()
在 java.security.AccessController.doPrivileged(Object , AccessControlContext , CallerID )
在 java.security.AccessController.doPrivileged(PrivilegedExceptionAction action, CallerID )
在 sun.misc.URLClassPath.getLoader(URL )
在 sun.misc.URLClassPath.getLoader(Int32 )
在 sun.misc.URLClassPath.access$000(URLClassPath , Int32 )
在 sun.misc.URLClassPath$1.next()
在 sun.misc.URLClassPath$1.hasMoreElements()
在 IKVM.Internal.AssemblyClassLoader.<GetResourcesImpl>d__0.MoveNext()
在 IKVM.Internal.AssemblyClassLoader.<GetResourcesImpl>d__0.MoveNext()
在 IKVM.NativeCode.ikvm.runtime.AssemblyClassLoader.getResources(ClassLoader classLoader, Assembly assembly, String name)
在 ikvm.runtime.AssemblyClassLoader.getResources(ClassLoader , Assembly , String )
在 ikvm.runtime.AssemblyClassLoader.getResources(String name)
在 java.util.ServiceLoader.LazyIterator.hasNext()
在 java.util.ServiceLoader$1.hasNext()
在 java.nio.charset.Charset$1.getNext()
在 java.nio.charset.Charset$1.hasNext()
在 java.nio.charset.Charset$2.run()
在 java.nio.charset.Charset$2.run()
在 java.security.AccessController.doPrivileged(Object , AccessControlContext , CallerID )
在 java.security.AccessController.doPrivileged(PrivilegedAction action, CallerID )
在 java.nio.charset.Charset.lookupViaProviders(String )
在 java.nio.charset.Charset.lookup2(String )
在 java.nio.charset.Charset.lookup(String )
在 java.nio.charset.Charset.defaultCharset()
在 sun.nio.cs.StreamEncoder.forOutputStreamWriter(OutputStream out, Object lock, String charsetName)
在 java.io.OutputStreamWriter..ctor(OutputStream out)
在 java.io.PrintStream..ctor(Boolean , OutputStream )
在 java.io.PrintStream..ctor(OutputStream out, Boolean autoFlush)
在 java.lang.StdIO..cctor()
InnerException: