我想使用 DDE 与 java 和 java eclipse 编辑器通信来运行一些简单的代码。我将调用的库pretty-tools-JDDE-2.0.3.jar 导入到我的项目中,但徒劳无功 - DDEClient 和其他 DDE 类型无法识别。这是代码:
public class Testdde {
public static void main(String[] args) {
DDEClient client;
Conversation url = null;
client = DDEClient.getInstance();
try {
url = client.connect("Iexplore", "WWW_OpenURL");
} catch (DDEException e) {
System.out.println("No running instance of Internet Explorer is found. Stopping.");
e.printStackTrace();
client.close();
return;
}
System.out.println("Connected to Internet Explorer");
System.out.println("Opening \"http://www.java.com/\" in a new window");
try {
url.request("http://www.java.com/,,0");
} catch(DDEException e) {
e.printStackTrace();
}
try {url.close();} catch (Exception ignore) {}
client.close();
}
}