How to share a context object between two machines assuming that one has app server and another one just has JDK?

What do you mean by 'share a context object'?? Can you elaborate what you are exactly trying to do?

If you just want the attributes of the context to be passed to the machine that has only the jdk, you can either iterate through the context and pass all the variables, or directly pass the context object to the machine.

Do you try to share the app server side state to the jdk client? If yes, then you might need to choose a mechanism to serialize the data over to the client. Web services, RMI, self defined mechanism might be helpful.