[xSocket-develop] Hello. I have got a problem while following xSocket tutorial.
Status: Inactive
Brought to you by:
grro
|
From: Cyrus H. <cy...@cy...> - 2009-12-25 04:50:35
|
I have used sources below, compiled them using xSocket 2.8.1 which I downloaded from sf.net. Compiling itself threw no error, but when I tried to execute, "*Exception in thread "main" java.lang.NoClassDefFoundError: org/xsocket/connection/IHandler*" occured. So, I downloaded whole xSocket source from sf.net, compiled it myself, "jar"ed it myself with version.txt inside it. But same exception occured. Here are the sources I have wrote. // xSTServer.java package kr.cyrush.xSocketTest; import org.xsocket.connection.Server; public class xSTServer { private static Server tSrv; public static void main(String[] args) { if(args.length!=1) { System.out.println("Usage: java kr.cyrush.xSocketTest.xSTServer <port>"); System.exit(1); } try { tSrv=new Server(Integer.parseInt(args[0]),new xSTServerUnit()); tSrv.run(); } catch(Exception e) { System.out.println(e.getMessage()); } } protected static void shutItDown() { try { tSrv.close(); } catch(Exception e) { System.out.println(e.getMessage()); } } } // xSTServerUnit.java package kr.cyrush.xSocketTest; import java.io.IOException; import java.nio.BufferUnderflowException; import java.nio.channels.ClosedChannelException; import org.xsocket.MaxReadSizeExceededException; import org.xsocket.connection.IDataHandler; import org.xsocket.connection.INonBlockingConnection; public class xSTServerUnit implements IDataHandler { public boolean onData(INonBlockingConnection nbc) throws IOException,BufferUnderflowException,MaxReadSizeExceededException { String data=nbc.readStringByDelimiter(new Character('\n').toString()); nbc.write(data+new Character('\n').toString()); if(data.equalsIgnoreCase("SHUTDOWN")) xSTServer.shutItDown(); return true; } } // commands I used: (let's suppose that the sources are in ~/java/sources/kr/cyrush/xSocketTest) cd ~/java/sources javac -cp ~/java/lib/xSocket-2.8.1.jar -d ../classes kr/cyrush/xSocketTest/*.java cd ../classes java kr.cyrush.xSocketTest.xSTServer 9081 Then, the exception occurs. I cannot figure what is the problem out. I have googled the Exception but nothing found except Sun's Java API saying that the exception occurs when JVM cannot find class definition. What is class definition? And why xSocket's IHandler does not hav it? Please answer my question. Thank you. -- Cyrus Hackford; Sent from my Mac ---------------- email : cy...@cy... |