Hot code replacement (HCR), which doesn’t require a restart, is a fast debugging technique in which the Java debugger transmits new class files over the debugging channel to another JVM. With this new feature in Visual Studio Code (VS Code), you can start a debugging session and change a Java file in your development environment, and the debugger will replace the code in the JVM running your code. This is the faster and easier way in Java to facilitate experimental development and to foster iterative trial-and-error coding. Below is an illustration of how you can use HCR with Debugger for Java in Visual Studio Code.
HCR only works when the class signature does not change; you cannot remove or add fields to existing classes, when using HCR. However, HCR can be used to change the body of a method.
Since announcing several new extensions for Java on VS Code in our last blog post, we’ve further enhanced our updates to those extensions to provide a better editing experience for Java developers using VS Code.
Java Test Runner
We have added a few new features to better support JUnit in VS Code.
- Added test explorer so now you can view and locate all tests from within the test explorer
- Added status bar item to show test status and statistics.
- Added command to show test output window, by default it won’t be opened while running tests.
With the updated Tomcat extension, you can now create new Tomcat server from server explorer using the newly added “Add” button and run war package on it. You can also create the server during the deployment.
In our latest release of Checkstyle extension, properties in the Checkstyle configuration file get automatically resolved, which makes it easier for you to edit the configuration.
Please also refer to Checkstyle extension home page to view all the convenient commands that you can use to configure your Checkstyle.
We’ve also released our latest Maven extension under Microsoft. The new release brings new support to use maven wrapper as executable. The Maven wrapper is widely used to provide a fully encapsulated build setup for the project.
Try it out
Please don’t hesitate to have a try using VS Code, a lightweight code editor, for your Java development and let us know your feedback!
- Install the Java Extension Pack which includes Language Support for Java(TM) by Red Hat, Debugger for Java
- Install the extensions mentioned in this blog individually based on your needs. In case you’re working on Spring Boot, there’s also great support provided by Pivotal and Microsoft available on VS Code.
- Learn more about Java on Visual Studio Code.
- Explore our step by step Java Tutorials on VS Code.
|Xiaokai He, Program Manager
Xiaokai is a program manager working on Java tools and services. He’s currently focusing on making Visual Studio Code great for Java developers, as well as supporting Java in various of Azure services.