Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problum with JXTA Platefoam Installation.  RSS feed

 
kashif hameed
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello every one,
i have installed JXTA Shell ... When i try to run a program which creates peer it give me error.
---------------------------------------------------------------------------
import net.jxta.peergroup.PeerGroup;
import net.jxta.peergroup.PeerGroupFactory;
import net.jxta.exception.PeerGroupException;

/**
* This is a simple example of how an application would start jxta
*/

public class HelloWorld {

static PeerGroup netPeerGroup = null;

public static void main(String args[]) {

System.out.println("Starting JXTA ....");
HelloWorld myapp = new HelloWorld();
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.out.println( "Good Bye ....");
myapp.netPeerGroup.stopApp();
System.exit(0);
}

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);
}
}
}
--------------------------------------------------------------
error is
---------
Starting JXTA ....
java.lang.NoClassDefFoundError: org/apache/log4j/Priority
at com.HelloWorld.startJxta(HelloWorld.java:92)
at com.HelloWorld.main(HelloWorld.java:74)
Exception in thread "main"
----------------
plz ans me as soon as possible.....
Kashif Hameed
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NoClassDefFoundError means that the JVM can't find a class that is needed. In this case, it's looking for the org.apache.log4j.Priority class. Is the log4j.jar file on your classpath?
 
kashif hameed
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sir,
First of all me very much thankfull for this nice reply.... i have problum with setting classpaths ...
plz tell me the exect syntex of adding classpaths...
i m using Windows Xp .tell me the right class path syntex..
thx again
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 3 ways to set the classpath if you are just using Java. If you are using an IDE, there is probably a specific way for you to set the classpath for your project in your IDE.

First, you can set CLASSPATH as a permanent environment variable. This makes it permanently available to all Java programs. To set it you have to go to Start->Control Panel-> System -> Advanced Tab -> Environment Variables. Under System Variables click 'New...'. Type CLASSPATH into the Variable Name field and enter a series of classpath root locations separated by semicolons ( ; ) as the value. A path root location can be either a directory or a JAR file. Define absolute paths to all of these.

The second way is to open a Command Line window and set the classpath for that command line window only. On the command line, enter:


Another way is to set the classpath in the java command as a command line argument. The option can be used as either '-cp' or '-classpath'. Just like before, you specify a list of root locations separated by semicolons.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!