在java应用程序中导入DLL文件 [英] Importing DLL file in java application
问题描述
Hello All,
提前致谢。
我有CP52OO.dll文件,这是用于与CP5200控制器通信。 DLL是32位,64位dll vrsion不可用。提供商无法提供相同的功能。
所以我在c#project ON 64位系统中导入了相同的dll并完成了我的控制器测试工作。测试实用程序工作正常。
现在问题是我只需要使用java应用程序与控制器通信。我试图生成c#dll并尝试在java应用程序中导入它但我也没能导入那个dll。
现在我终于得出结论我必须开发使用c#代码在.net中运行Windows服务,java应用程序将调用该服务。
我开始使用Windows服务。同时我想从世界开发者那里得到一些更好的方法如何处理这个问题。
请在提供方法时考虑以下几点:
1]由于64位dll不可用,我无法使我的java应用程序系统依赖。
2] C#代码工作正常。但是在java应用程序中导入C#dll也面临问题,因为我们不能将c#视为模块。
3]方法应该是健壮的,不应该对系统有任何依赖,执行时间不应该很长。 br />
我尝试了什么:
我已经尝试了所有可行的方法在java中加载库文件。但是依赖不能被删除,因为dll是32位。
Hello All,
Thanks in advance.
I have CP52OO.dll file which is used to communicate with CP5200 controller. DLL is 32 bit and 64 bit dll vrsion is not available. Provider is unable to provide same.
So I imported same dll in c# project ON 64 bit system and completed my controller testing work. Testing utility is working fine.
Now the problem is I need to communicate with controller using java application only. I tried to generate c# dll and tried to import it in java application but I failed to import that dll too.
Now I finally come to conclusion that I have to develop windows service in .net using c# code, and java application will call that service.
I am started working on windows service. Meanwhile I want some better approach from world developers how can I handle this problem.
Please consider below points while providing approach :
1] As 64 bit dll is not available I can not make my java application system dependent.
2] C# code is working perfectly fine. but C# dll importing in java application also facing issue as we can not consider c# as module.
3] Approach should be robust there should not be any dependency on system, execution time should not be long.
What I have tried:
I have tried all possible ways to load library file in java. But dependency can not be removed as dll is 32 bit.
推荐答案
正如我在前两个关于这个主题的问题中已经解释的那样,你需要使用Java Native使用Java的动态链接库的接口。
As I have already explained in your previous two questions on this subject, you need to use the Java Native Interface to use a dynamic link library from Java.
这篇关于在java应用程序中导入DLL文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!