Your question is a bit ambiguous. Are you sending a file *.classor class instance ? I bet you really mean an instance of the class, as you literally said you want to send it back. This only makes sense if it was a case. The other side should also have a class file in its class path. Then you can just importclass and apply the class to readObject()the desired class. Finally, you can call methods on it in accordance with the class contract.
See also:
If you really send the file *.class, using ClassLoaderto download it will really be the answer.
source
share