2013-07-04 110 views
2

我真的在我的應用程序獲得以下錯誤Java錯誤,C#.NET 2.0中框架

錯誤:使用.NET 2.0中,Windows XP操作系統

System.TypeInitializationException: The type initializer for 'java.util.Locale' threw an exception. ---> java.lang.UnsatisfiedLinkError: Unable to load DLL 'vjsnativ': The specified module could not be found. (Exception from HRESULT: 0x8007007E) ---> System.DllNotFoundException: Unable to load DLL 'vjsnativ': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
    at com.ms.vjsharp.windowing.win32.UnsafeWin32Calls.GetLocaleInfo<PInvokeHelper>vjsnativ(Int32 lcid, Int32 lctype, StringBuilder lpLCData, Int32 cchData) 
    at com.ms.vjsharp.windowing.win32.UnsafeWin32Calls.GetLocaleInfo(Int32 lcid, Int32 lctype, StringBuffer lpLCData, Int32 cchData) 
    at java.util.Locale..ctor(CultureInfo ci, String language, String ctryRgn, String variant) 
    at java.util.Locale..ctor(String languageCode, String ctryRgnCode) 
    at java.util.Locale..cctor() 
    --- End of inner exception stack trace --- 
    at java.lang.ExceptionInInitializerError.checkAndThrowException(Throwable thrown) 
    at java.util.Locale..cctor() 
    --- End of inner exception stack trace --- 
    at java.util.Locale.getDefault() 
    at com.ms.vjsharp.lang.StringImpl.toUpperCase(String mrString) 
    at com.vividsolutions.jts.io.WKTReader.getNextWord(StreamTokenizer tokenizer) 
    at com.vividsolutions.jts.io.WKTReader.readGeometryTaggedText(StreamTokenizer tokenizer) 
    at com.vividsolutions.jts.io.WKTReader.read(Reader reader) 
    at com.vividsolutions.jts.io.WKTReader.read(String wellKnownText) 

`米。請檢查並讓我知道你的答案和建議。

感謝

+2

你真的*需要*使用J#嗎?它很久以前就停止了。 –

+2

爲什麼downvote?有些人不願意與傳統的第三方庫集成 - 這篇文章對我來說只是一個很大的幫助 – Andy

回答

0

你可以找到並複製vjsnativ.dll應用程序的目錄,也可以調用任何J#代碼之前添加以下代碼。

// This problem started with .NET 4 
if (Environment.Version.Major >= 4) 
{ 
    string dllpath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"..\Microsoft.NET\Framework\v2.0.50727"); 
    dllpath = Path.GetFullPath(dllpath); 
    LoadLibrary(Path.Combine(dllpath, "vjsnativ.dll")); 
} 
// J# code should work now 
+0

除了LoadLibrary沒有被定義,Assembly.LoadFile給這個文件帶來了以下錯誤:模塊需要包含一個程序集清單。 (從HRESULT異常:0x80131018) –

+0

因此,使LoadLibrary定義:[DllImport(「kernel32.dll」)] public static extern IntPtr LoadLibrary(string dllToLoad); – LogicG8