我已经开始阅读“实用JXTA II”中的“如何将JXTA用于我想做的应用程序”。尽管所提供的代码(示例)不适用于JXTA 2.7。更具体地说,Z_Tools_And_Others的Tools类没有编译,因为TheRendezVous类没有2.6中存在的getConnectedPeers()和getConnectedRendezVous()。因此,我不能继续,因为大多数示例中都使用了Tools类。熟悉这个的人有什么建议吗?是不是更好的做法是先使用2.6进行学习,然后再迁移到2.7?
谢谢。
发布于 2011-09-11 03:46:37
很抱歉回复得太晚了:实用JXTA II的文件可以从here获得。
我非常确定您正在尝试使用带有2.7的2.6代码。如果您在使用jxta II的实际示例时仍然遇到问题,请告诉我。
发布于 2011-09-12 07:13:15
package Examples.Z_Tools_And_Others;
public class Tools {
public static void popConnectedRendezvous(RendezVousService TheRendezVous, String Name) {
Enumeration<ID> TheList = TheRendezVous.getConnectedRendezVous();
int Count = 0;
while (TheList.hasMoreElements()) {
Count = Count + 1;
PopInformationMessage(Name, "Connected to rendezvous:\n\n"
+ TheList.nextElement().toString());
}
if (Count==0) {
PopInformationMessage(Name, "No rendezvous connected to this rendezvous!");
}
}TheList不工作.The方法getConnectedRendezVous在2.7中被删除。替换它的是返回一个列表,.That以后会产生更多的错误。我想我可以用一个listIterator来代替.nextElement(),同样的问题也存在于相同类的popConnectedPeers(RendezVousService TheRendezVous,String Name)。
另请参阅第166行
打包Examples.K_Service;
公共类_710_Astrology_Service_Example实现服务,可运行
Result.setCompat(StdPeerGroup.STD_COMPAT);
STD_COMPAT将被删除。我将其替换为:
ModuleImplAdvertisement ad =StdPeerGroup.getDefaultModuleImplAdvertisement();
Result.setCompat(ad.getCompat());
不知道它是好的还是not..code编译了tho :P
https://stackoverflow.com/questions/7301676
复制相似问题