I think you need to modify your classpath to include the directory (or jar
file) that contains test.server.HelloServer.

-----Original Message-----
From: Frederik Uyttersprot [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 22, 2002 12:40 PM
To: [EMAIL PROTECTED]
Subject: java.lang.NoClassDefFoundError problem


Hello,

I just started playing with XML-RPC and have the following problem.
I'm also quite new to Java. I'm trying an example from Oreilly's Java
& XML 2nd edition, getting the following error,

D:\Java\bin\java.exe   test.server.HelloServer
Working Directory - D:\Java\temp\
Class Path -
D:\Java\temp;d:\java\lib;d:\java\xmlrpc\xmlrpc-1.1.jar;.;d:\program
files\Kawa\kawaclasses.zip;D:\Java\lib\tools.jar;D:\Java\jre\lib\rt.jar;D:\J
ava\jre\lib\i18n.jar
java.lang.NoClassDefFoundError: test/server/HelloServer Exception in thread
"main" Process Exit...

What can I do here? Compilation is error free...

Thanks in advance.

The code,

package test.server;

import java.io.IOException;

import org.apache.xmlrpc.*;
import test.handler.*;

public class HelloServer 
{
        public static void main() 
        {
                try 
                {
                        System.out.println("Setting up...");
                        
                        WebServer server = new WebServer(8080);
                        
                        server.addHandler("hello", new HelloHandler());
                        
                        server.run();
                        
                        System.out.println("Now accepting requests...");
                        
                } catch(IOException e) 
                {
                        System.out.println("Could not start server : " +
e.getMessage());
                }
        }
}

package test.handler;

public class HelloHandler 
{
        public String sayHello(String name) 
        {
                return "Hello " + name;
        }
}

PATH IS == d:\java\lib;d:\java\xmlrpc;\java\xerces;.;d:\program
files\Kawa\kawaclasses.zip;D:\Java\lib\tools.jar;D:\Java\jre\lib\rt.jar;D:\J
ava\jre\lib\i18n.jar

Got this by using,

import java.util.*;

public class PrintClassPath
{
    public static void main(String args[])
    {
        try
        {
            System.out.println("PATH IS == " +
System.getProperty("java.class.path"));
        } catch (Throwable t)
          {
            t.printStackTrace();
          }
    }
}

Reply via email to