将Java文件编译为DLL程序集时出错
我一直在尝试使用IKVM将Java类转换为DLL。 IKVM可以轻松无误地进行转换。但在VS中运行时,会引发以下异常: System.TypeInitializationException: 'The type initializer for 'sun.security.jca.Providers' threw an exception. **1 of 2 Inner Exceptions** : TypeInitializationException: The type initializer for 'java.security.Security' threw an exception. **2 of 2 Inner Exceptions** : - InnerException {"Method not found: 'Void System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.Security.AccessControl.FileSystemRights, System.IO.FileShare, Int32, System.IO.FileOptions)'."} System.Exception {System.MissingMethodException}. 我的C#代码是:将Java文件编译为DLL程序集时出错,java,c#,ikvm,Java,C#,Ikvm,我一直在尝试使用IKVM将Java类转换为DLL。 IKVM可以轻松无误地进行转换。但在VS中运行时,会引发以下异常: System.TypeInitializationException: 'The type initializer for 'sun.security.jca.Providers' threw an exception. **1 of 2 Inner Exceptions** : TypeInitializationException: The type initializer
package aesgzip;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
import java.util.Scanner;
public class AESGzip {
private static final String key = MyKeyString;
private static final String IV = MyIV;
public static byte[] decrypt(byte[] encrypted) {
try {
IvParameterSpec IVSpec = new IvParameterSpec(IV.getBytes("UTF-8"));
SecretKeySpec KEYSpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(2, KEYSpec, IVSpec);
return cipher.doFinal(encrypted);
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}
using System;
using aesgzip;
namespace AESTest
{
public partial class Form1 : Form
{
public Form1()
{
byte[] b = Convert.FromBase64String(myBASE64String);
byte[] x = AESGzip.decrypt(b);
Console.WriteLine(x);
}
}
}
我也有同样的问题。你解决了吗???如果你已经解决了,请帮助我