/** * This is a simple example of how an application would start jxta */
public class SimpleJxtaApp {
static PeerGroup netPeerGroup = null;
public static void main(String args[]) {
System.out.println("Starting JXTA ...."); SimpleJxtaApp myapp = new SimpleJxtaApp(); myapp.startJxta();
System.out.println("Hello from JXTA group " + netPeerGroup.getPeerGroupName() ); System.out.println(" Group ID = " + netPeerGroup.getPeerGroupID().toString()); System.out.println(" Peer name = " + netPeerGroup.getPeerName()); System.out.println(" Peer ID = " + netPeerGroup.getPeerID().toString()); System.exit(0); }
public void SimpleJxtaApp() { }
private void startJxta() { try { // create and start the default JXTA NetPeerGroup netPeerGroup = PeerGroupFactory.newNetPeerGroup(); } catch (PeerGroupException e) { // could not instantiate the group, print the stack and exit System.out.println("fatal error : group creation failure"); e.printStackTrace(); System.exit(1); } } }
i get this error:
SimpleJxtaApp.java:58: package net.jxta.peergroup does not exist import net.jxta.peergroup.PeerGroup; ^ SimpleJxtaApp.java:59: package net.jxta.peergroup does not exist import net.jxta.peergroup.PeerGroupFactory; ^ SimpleJxtaApp.java:60: package net.jxta.exception does not exist import net.jxta.exception.PeerGroupException; ^
can anyone tell me why this is? i have jxta.jar in my classpath already.
I dont know the distribution of this, but it may be a problem with your classpath! :)) Try to see where are those classes declared in import statements and include that directory or jar file into your classpath.