当jar文件具有各种传出依赖项时,如何使用IKVMC将特定JAR文件转换为DLL? [英] How do I use IKVMC to convert a specific JAR file to DLL when the jar file has various outgoing dependencies?

查看:395
本文介绍了当jar文件具有各种传出依赖项时,如何使用IKVMC将特定JAR文件转换为DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Websphere MQ。我需要将特定的JAR文件转换为DLL。 此处是WMQ客户端的JARS集合。 此处是列出各种传入和传出依赖关系的集合的JAR Analyzer文件。

I'm working with Websphere MQ. And I need to convert a specific JAR file to a DLL. Here is the collection of JARS from the WMQ Client. Here is the JAR Analyzer File for the collection listing the various incoming and outgoing dependencies.

我要转换的文件是 com.ibm.mq.jar ,它具有以下传出依赖项 -

The File I want to convert is com.ibm.mq.jar which has the following outgoing dependencies -

 com.ibm.mq.commonservice.jar
 com.ibm.mq.headers.jar
 com.ibm.mq.jmqi.jar

问题是我不知道要在命令提示符下传递什么命令来转换jar没有丢失任何类。

基本上,我需要访问属于 com的MQMessage和MQMD .ibm.mq.jar 但是当我自己转换它时,那些特定的类不会被导入。

Basically, I need to get access to MQMessage and MQMD which are part of com.ibm.mq.jar but when I convert it by itself, those specific classes doesn't get imported.

我看了一下另一个类似的StackOverflow问题但主要区别在于依赖拒绝是循环的。

I took a look at another similar StackOverflow Question but the main difference is that the dependencies are circular.

例如, com.ibm.mq.headers.jar 取决于 com.ibm.mq.jmqi.jar ,反之亦然。

For example, com.ibm.mq.headers.jar depends on com.ibm.mq.jmqi.jar and vice-versa.

推荐答案

我有不知道为什么你不会读取我给出的MQ链接。

I have no idea why you will not read the MQ link that I gave.

(1)创建一个纯粹的.NET托管MQ应用程序

(1) Create a pure '.NET managed' MQ application

int openOptions = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;
Hashtable qMgrProp = new Hashtable();
qMgrProp.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);  /* very important */
qMgrProp.Add(MQC.HOST_NAME_PROPERTY, "10.10.10.10");
qMgrProp.Add(MQC.CHANNEL_PROPERTY, "TEST.CHL");
qMgrProp.Add(MQC.PORT_PROPERTY, 1414);
qMgrProp.Add(MQC.USER_ID_PROPERTY, "myUserID");

try
{
   MQQueueManager _qMgr = new MQQueueManager("MQA1", qMgrProp);

   MQQueue queue = _qMgr.AccessQueue("TEST.Q", openOptions, null, null, null);

   /* Do whatever you want to do */

   queue.Close();
   _qMgr.Disconnect();
}
catch (MQException mqex)
{
   System.Console.Out.WriteLine("MQTest01 cc=" + mqex.CompletionCode + " : rc=" + mqex.ReasonCode);
}

(2)编译它。

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe /nologo /t:exe /r:System.dll /r:"C:\Program Files (x86)\IBM\WebSphere MQ\bin\amqmdnet.dll" /out:bin\Release\Test.exe Test.cs  Properties\AssemblyInfo.cs

(3)创建Test.config文件(与Test.exe一起使用)Test.exe已存储

(3) Create "Test.config" file (to go with Test.exe) where Test.exe is stored

<configuration>
  <appSettings>
    <add key="NMQ_MQ_LIB" value="managed"/>
  </appSettings>
</configuration>

(4)将3个文件复制到目标PC:Test.exe,Test.config和amqmdnet。 dll然后运行它。您可能需要更新PATH环境变量以指向amqmdnet.dll所在的目录。这通常不需要,但有时Windows会变得挑剔。

(4) Copy 3 files to your target PC: Test.exe, Test.config and amqmdnet.dll and then run it. You may need to update the PATH environment variable to point to the directory that amqmdnet.dll resides in. This is generally not needed but sometimes Windows get picky.

这篇关于当jar文件具有各种传出依赖项时,如何使用IKVMC将特定JAR文件转换为DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆