Search code examples
javaintellij-idea

Java Intellij: Make change on external lib code and take effect immediately


I am working on Java with Intellij. Now I can debug into my external lib code by attaching source to jar lib. But now I want to make change on lib's source code and make it take effect immediately without repackaging to jar and including again to my main project. Can I do that ?


Solution

  • Not a good idea - conceptually.

    Either something is an external library. Then its deployment artefact is a JAR. Or it is a "source project".

    In other words: you are trying to eat the cake and have it at the same time. If it you find a technical way to hack yourself there - you shouldn't go there. Because it is conceptually wrong.

    If the question is mainly about dynamically updating a running JVM - for that you can use tools such as JRebel. But that also requires that your JVM is running with the JRebel agent (which is fine for test/dev systems, but a no-go in production environments).