2015-05-29 99 views
1

我希望你能幫我解決一個編譯MQIVP示例程序的問題。下載的WebSphere MQ客戶端7.1.0.6到我的Windows 7 PC和增加外部JAR引用後,我發現了以下錯誤:MQSampleMessageManager無法解析爲類型

MQSampleMessageManager messageMgr不能被解析爲一個類型

private MQSampleMessageManager messageMgr; 
private String hostname; 
private String channel = null; 
private String queueMgr; 
private MQQueueManager queueManager; 
private String port = "-1"; // @L1C 
private Hashtable properties = null; // @L1A 
// An output stream writer to convert the characters to....... 

回答

0

我我正在使用MQ v8002。

MQSampleManager類與MQIVP位於同一目錄中。您需要設置CLASSPATH。編譯時出現以下錯誤。

MQIVP.java:46: error: cannot find symbol 
     private MQSampleMessageManager messageMgr; 
      ^
     symbol: class MQSampleMessageManager 
     location: class MQIVP 
    MQIVP.java:94: error: cannot find symbol 
     messageMgr = new MQSampleMessageManager("mqjcivp"); 

        ^
    symbol: class MQSampleMessageManager 
    location: class MQIVP 
2 errors 

設置CLASSPATH解決了這個問題:

CLASSPATH=%CLASSPATH%;C:\Program Files\IBM\WebSphere MQ\Tools\wmqjav\samples\MQSampleMessageManager.class