J
juicy
i try to compile and run the code helloworld but there is an exception in
thread main..
Exception in thread "main" java.lang.NoClassFoundError: helloworld <wrong
name: net/jxta/impl/shell/bin/helloworld/helloworld
what cause the problem and how to solve?
i compile with :
set
classpath=.\beepcore.jar;.\jxta.jar;.\cryptix32.jar;.\cryptix-asn1.jar;.\javax.servlet.jar;.\jxtaptls.jar;.\jxtasecurity.jar;.\jxtashell.jar;.\log4j.jar;.\minimalBC.jar;.\org.mortbay.jetty.jar;.\;%classpath%
javac *.java
pause
and run with:
set
classpath=.\beepcore.jar;.\jxta.jar;.\cryptix32.jar;.\cryptix-asn1.jar;.\javax.servlet.jar;.\jxtaptls.jar;.\jxtasecurity.jar;.\jxtashell.jar;.\log4j.jar;.\minimalBC.jar;.\org.mortbay.jetty.jar;.\;%classpath%
java helloworld
pause
all the jar file has been put inside the same directory
here is the code
package net.jxta.impl.shell.bin.helloworld;
import net.jxta.impl.shell.ShellApp;
import net.jxta.impl.shell.ShellEnv;
import net.jxta.impl.shell.ShellObject;
import net.jxta.peergroup.PeerGroup;
/**
* A simple example command for the JXTA Shell.
*/
public class helloworld extends ShellApp
{
/**
* The shell environment.
*/
private ShellEnv theEnvironment;
/**
* Invoked by the Shell to starts the command.
*
* @param args a set of arguments passed to the command.
* @return a status code indicating the success or failure
* of the command.
*/
public int startApp(String[] args)
{
println("Starting command...");
// Get the shell's environment.
theEnvironment = getEnv();
// Use the environment to obtain the current peer group.
ShellObject theShellObject = theEnvironment.get("stdgroup");
PeerGroup aPeerGroup = (PeerGroup) theShellObject.getObject();
// Check to see if there were any command arguments.
if ((args == null) || (args.length == 0))
{
// Print the peer name to the console.
println("My peer name is " + aPeerGroup.getPeerName());
}
else
{
println("This command doesn't support arguments.");
// Return the 'parameter error' status code.
return ShellApp.appParamError;
}
// Return the 'no error' status code.
return ShellApp.appNoError;
}
/**
* Invoked by the Shell to stop the command.
*/
public void stopApp()
{
// Do nothing.
}
}
thread main..
Exception in thread "main" java.lang.NoClassFoundError: helloworld <wrong
name: net/jxta/impl/shell/bin/helloworld/helloworld
what cause the problem and how to solve?
i compile with :
set
classpath=.\beepcore.jar;.\jxta.jar;.\cryptix32.jar;.\cryptix-asn1.jar;.\javax.servlet.jar;.\jxtaptls.jar;.\jxtasecurity.jar;.\jxtashell.jar;.\log4j.jar;.\minimalBC.jar;.\org.mortbay.jetty.jar;.\;%classpath%
javac *.java
pause
and run with:
set
classpath=.\beepcore.jar;.\jxta.jar;.\cryptix32.jar;.\cryptix-asn1.jar;.\javax.servlet.jar;.\jxtaptls.jar;.\jxtasecurity.jar;.\jxtashell.jar;.\log4j.jar;.\minimalBC.jar;.\org.mortbay.jetty.jar;.\;%classpath%
java helloworld
pause
all the jar file has been put inside the same directory
here is the code
package net.jxta.impl.shell.bin.helloworld;
import net.jxta.impl.shell.ShellApp;
import net.jxta.impl.shell.ShellEnv;
import net.jxta.impl.shell.ShellObject;
import net.jxta.peergroup.PeerGroup;
/**
* A simple example command for the JXTA Shell.
*/
public class helloworld extends ShellApp
{
/**
* The shell environment.
*/
private ShellEnv theEnvironment;
/**
* Invoked by the Shell to starts the command.
*
* @param args a set of arguments passed to the command.
* @return a status code indicating the success or failure
* of the command.
*/
public int startApp(String[] args)
{
println("Starting command...");
// Get the shell's environment.
theEnvironment = getEnv();
// Use the environment to obtain the current peer group.
ShellObject theShellObject = theEnvironment.get("stdgroup");
PeerGroup aPeerGroup = (PeerGroup) theShellObject.getObject();
// Check to see if there were any command arguments.
if ((args == null) || (args.length == 0))
{
// Print the peer name to the console.
println("My peer name is " + aPeerGroup.getPeerName());
}
else
{
println("This command doesn't support arguments.");
// Return the 'parameter error' status code.
return ShellApp.appParamError;
}
// Return the 'no error' status code.
return ShellApp.appNoError;
}
/**
* Invoked by the Shell to stop the command.
*/
public void stopApp()
{
// Do nothing.
}
}