我有一个使用Eclipse Kepler的spring mvc项目,并希望在该项目中使用.net dll。
之后完成了为java做好dll准备的过程在我的
spring project -> Properties -> Java Class Path -> libraries -> External Jar -> Located my jar used to call the c# methods.
接下来添加了原生库
spring project -> Properties -> Java Class Path -> libraries -> Located external jar added -> expand -> highlight Native Library Locaton -> path to where my dll's are located
在我的spring mvc项目代码中,我可以在外部jar文件中创建对象的实例。
MyJavaCallingComObject testObj = new MyJavaCallingComObject ();
testObj.GetDetails("John Doe");
GetDetails = supposed to return user information given the user name
然而,当我去调用一个方法时,我遇到了这个
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (os_windows_x86.cpp:143), pid=8644, tid=10476
# guarantee(result == EXCEPTION_CONTINUE_EXECUTION) failed: Unexpected result from topLevelExceptionFilter
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
我的Eclipse位于c:\eclipse
我的所有工作空间都位于d:\workspaces
答案 0 :(得分:1)
我想这篇文章准确描述了您的目标:
http://java.dzone.com/articles/building-java-applications-use
它显示了构建Sprint MVC应用程序的分步指南,该应用程序利用了直接从JAVA使用的.NET DLL。