Install
- download latest release of DCEVM Java patch and launch the installer
(e.g.
java -jar installer-light.jar
). Currently you need to select correct installer for Java major version (7/8). - select java installation directory on your disc and press “Install DCEVM as altjvm” button. Java 1.7+ versions are supported. Be sure to have write access to the java installation directory (on Windows: Start > cmd > right click > run as administrator).
- download latest release of Hotswap agent jar,
unpack
hotswap-agent.jar
and put it anywhere on your disc. For example:C:\java\hotswap-agent.jar
Run your application
- add following command line java attributes:
-XXaltjvm=dcevm -javaagent:PATH_TO_AGENT\hotswap-agent.jar
(you need to replace PATH_TO_AGENT with an actual) directory. For examplejava -XXaltjvm=dcevm -javaagent:c:\java\hotswap-agent.jar YourApp
. See dedicated pages for Eclipse, IntelliJ IDEA and Netbeans for IDE specific setup guides. If your application is already running, you still can attach agent jar using the example code snippet. - (optional) create a file named “hotswap-agent.properties” inside your resources directory, see available properties and default values: https://github.com/HotswapProjects/HotswapAgent/blob/master/hotswap-agent-core/src/main/resources/hotswap-agent.properties
- (optional) in case you are not using
autoHotswap=true
and therefore not using the hotswapping mechanism provided by HotswapAgent, you may want to add-XX:TraceRedefineClasses=1
as an additional JVM argument in order to get feedback about reloaded classes. -
start the application in debug mode, check that the agent and plugins are initialized correctly:
HOTSWAP AGENT: 9:49:29.548 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent - unlimited runtime class redefinition. HOTSWAP AGENT: 9:49:29.725 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [org.hotswap.agent.plugin.hotswapper.HotswapperPlugin, org.hotswap.agent.plugin.jvm.AnonymousClassPatchPlugin, org.hotswap.agent.plugin.hibernate.HibernatePlugin, org.hotswap.agent.plugin.spring.SpringPlugin, org.hotswap.agent.plugin.jetty.JettyPlugin, org.hotswap.agent.plugin.tomcat.TomcatPlugin, org.hotswap.agent.plugin.zk.ZkPlugin, org.hotswap.agent.plugin.logback.LogbackPlugin] ... HOTSWAP AGENT: 9:49:38.700 INFO (org.hotswap.agent.plugin.spring.SpringPlugin) - Spring plugin initialized - Spring core version '3.2.3.RELEASE'
- save a changed resource and/or use the HotSwap feature of your IDE to reload changes