I have one application(for which i have installed separate JRE) that communicates with the help of the API given by the other application(which comes with its own JRE) to perform some task .But due to this dependance , we are forced to compile all our classes in other applications JVM (as opposite we wanted that only classes that are making use of their API should be compiled their and rest in our JVM) .
So is their any way so that we can get only those classes compiled which is required by other application's JVM , and rest in our JVM . ??
we are forced to compile all our classes in other applications JVM
But that's where defining Remote Interfaces come in to the picture right? you'd define your APIs as Remote Interfaces, package them as JAR file, use that JAR in both the applications, one which implements it and the other which uses it. If you haven't taken a look at it so far, here is it - http://docs.oracle.com/javase/tutorial/rmi/compiling.html
Googling doesn't make you a genius. But not Googling makes you dumber.