I am running a java spring boot application as jar file with DCEVM hot-swap agent. When i change some class files in my jar file the application is not reloading those changes. But If I extract my jar file and run my application as a simple java class file adding all dependencies to class path( like how IntelliJ Idea does) then replace any of the class file it reloads successfully.
Running extracted jar file:
java -XXaltjvm=dcevm -javaagent:path/hot-swap/hotswap-agent-1.3.1-SNAPSHOT.jar=autoHotswap=true -Dspring.profiles.active=local -Dserver.port=8082 -classpath path/jdk1.8.0_191.jdk/Contents/Home/jre/lib/charsets.jar:--jdk-lib-jars:./path/classes:..other-jar-file-path com.company.app.App
after running above command if I am making any changes and recompiling and then replacing updated class file then the changes are detected and my app reflects the changes.
HOTSWAP AGENT: 15:35:55.349 RELOAD (org.hotswap.agent.config.PluginManager) - Reloading classes [com.company.controller.HealthController] (autoHotswap)
I get above log which tells me that class is reloaded. everything works fine.
Running jar file:
java -XXaltjvm=dcevm -javaagent:path/hot-swap/hotswap-agent-1.3.1-SNAPSHOT.jar=autoHotswap=true -Dspring.profiles.active=local -Dserver.port=8081 -jar app.jar
After running If I update the jar file with following command:
jar uf app.jar path/HealthController.class
jar file gets updated but changes does not reflect and there is no log generated.
HotswapAgent does not detect class modification inside jar file. Instead of it you can use extraClasspath config param. Look at http://hotswapagent.org/mydoc_configuration.html how to setup it.