Is it a good idea to compile java classes in runtime for updating a project without stopping the server?
And my next question is: can I replace the class of an existing object? I mean update some method behavior without recreating the Object.
Is it a good idea to compile java classes in runtime for updating a project without stopping the server?
And my next question is: can I replace the class of an existing object? I mean update some method behavior without recreating the Object.
Is it good idea to compile java classes in runtime for update project without stop the server?
I believe you mean that updating the newly compiled classes on a server without stoppping it. You can always do that but if the class is already loaded then it will make no difference and the jvm will keep using the older version of the class.
And next question is: can i replace the class of existing object? I mean update some method behavior without recreating Object.
Same answer as for the first question. If the class is already loaded then JVM will be using the old method/behavior. And if you have some object of the class that means it is already loaded.
I would make the redployment process so fast it doesn't matter. (This is not always an option) but I try to ensure I can compile, redeploy and restart a server process in well under 10 seconds. In this situation you don't need dynamic compilation.
Note: if you debugging a system and you recompile code, you can hot swap the changes for a running system from your IDE. (Usually works but sometimes does not depending on what you change)