How do I use IKVMC to convert a specific JAR file to DLL when the jar file has various outgoing dependencies?

我的未来我决定 提交于 2019-12-12 02:57:15

问题


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.

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

The problem is I don't know what command to pass in the command prompt to convert the jar without losing any of the classes.

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.

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

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


回答1:


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

(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) Compile it.

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) 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) 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.




回答2:


Talk about making your life more difficult than it needs to be. Make your application a '.NET managed' application then all you need is the MQ dll called amqmdnet.dll (supplied by IBM and it contains everything you need).

Hence, you can run your .NET application without a full install of MQ. Of course, deploying the amqmdnet.dll file with your application is not supported by IBM but neither is the complicated setup you are trying to do.



来源:https://stackoverflow.com/questions/25988538/how-do-i-use-ikvmc-to-convert-a-specific-jar-file-to-dll-when-the-jar-file-has-v

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!