Hi,
I am writing a distributed computing application for my project. I am receiving a java class file in byte stream from Client PC which i want to load in Current loader of server so that i can run any method present in received class. i want to load it in current loader because this received class is made by extending another Class which is present at server.

in the code bellow class received as byte is named PrimeNumberChecker and package name jdcclient. PrimeNumberChecker is made by extending Gthread which is present at server. I have made ByteCodeLoader which extends ClassLoader to load byte in loader. whats is wrong in the code

public static void main(String[] args) {
try {
ServerSocket serverSocket = new ServerSocket(9000);
System.out.println("Server listening on port 9000 for thread classes");

System.out.println("Waiting for connections.");
Socket client = serverSocket.accept();
System.out.println("Accepted a connection from: "+client.getInetAddress());

//Getting client classes in byteArray
DataInputStream dis = new DataInputStream(client.getInputStream());
int avail = dis.available();
System.out.println("Available = " + avail);
byte byteCode[] = new byte[avail];
dis.readFully(byteCode);

ByteCodeLoader loader = new ByteCodeLoader();
loader.setByteCode(byteCode);
Class getClass = loader.loadClass("jdcclient.PrimeNumberChecker", true);

dis.close();


//Getting Thread from client
ObjectInputStream ois = new ObjectInputStream(client.getInputStream());
GThread thr = (GThread) ois.readObject();

thr.start();

//System.out.println("OutPut is "+ output.intValue());
/*
ObjectOutputStream oos = new ObjectOutputStream(client.getOutputStream());
oos.writeObject(thr);

oos.flush();
oos.close();
*/
ois.close();
client.close();

} catch (Exception ex) {
ex.printStackTrace();
}
}