Im using RMI, I have two jar files. One Server Jar which contains rmi server, registry start code and all methods which performs action on database .
I put this jar file on tomcat web-apps directory.
Another jar is containing User Interface code, which runs on client side.
for performing any action server jar needs to be run all the time and RMI Registry always needs to be started so that client can communicate with database.
You can't execute the server from the client. The question doesn't begin to make sense. The server has to be already running for the client to have anything to connect to. You have to organise something at the server side to start it. And putting JAR files into the web apps directory doesn't accomplish that. You could write a Servlet or a listener that starts the RMI server when it's initialised, and stops it when destroyed. If you have to run it inside Tomcat at all, which isn't necessarily a good idea.