{"id":16275,"date":"2018-02-02T09:00:07","date_gmt":"2018-02-02T17:00:07","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/?p=16275"},"modified":"2018-02-02T09:00:07","modified_gmt":"2018-02-02T17:00:07","slug":"hot-code-replacement-for-java-comes-to-visual-studio-code","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/java\/hot-code-replacement-for-java-comes-to-visual-studio-code\/","title":{"rendered":"Hot Code Replacement for Java comes to Visual Studio Code"},"content":{"rendered":"<p>Hot code replacement (HCR), which doesn&#8217;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 <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-java-debug\">Debugger for Java<\/a> in Visual Studio Code.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Hot-Code-Replacement-for-Java-in-Visual-Studio-Code.gif\" rel=\"noopener noreferrer\"><img decoding=\"async\" width=\"1616\" height=\"597\" title=\"Hot Code Replacement for Java in Visual Studio Code \" alt=\"Hot Code Replacement for Java in Visual Studio Code \" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2018\/02\/Hot-Code-Replacement-for-Java-in-Visual-Studio-Code.gif\" \/><\/a><\/p>\n<p>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.<\/p>\n<p>Since announcing several new extensions for Java on VS Code in our last <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2018\/01\/11\/new-visual-studio-code-extensions-for-java-developers-maven-tomcat-and-checkstyle\/\">blog post<\/a>, we\u2019ve further enhanced our updates to those extensions to provide a better editing experience for Java developers using VS Code.<\/p>\n<h2>Java Test Runner<\/h2>\n<p>We have added a few new features to better support JUnit in VS Code.<\/p>\n<ol>\n<li>Added test explorer so now you can view and locate all tests from within the test explorer<\/li>\n<li>Added status bar item to show test status and statistics.<\/li>\n<li>Added command to show test output window, by default it won\u2019t be opened while running tests.<\/li>\n<\/ol>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Java-Test-Runner.png\" rel=\"noopener noreferrer\"><img decoding=\"async\" width=\"1767\" height=\"886\" title=\"Java Test Runner\" alt=\"Java Test Runner\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2018\/02\/Java-Test-Runner.png\" \/><\/a><\/p>\n<h2>Tomcat<\/h2>\n<p>With the updated <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=adashen.vscode-tomcat\">Tomcat<\/a> extension, you can now create new Tomcat server from server explorer using the newly added \u201cAdd\u201d button and run war package on it. You can also create the server during the deployment.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Create-new-Tomcat-Server.gif\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Create new Tomcat Server\" alt=\"Create new Tomcat Server\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2018\/02\/Create-new-Tomcat-Server.gif\" \/><\/a><\/p>\n<h2>Checkstyle<\/h2>\n<p>In our latest release of <a href=\"https:\/\/marketplace.visualstudio.com\/items\/shengchen.vscode-checkstyle\/changelog\">Checkstyle<\/a> extension, properties in the Checkstyle configuration file get automatically resolved, which makes it easier for you to edit the configuration.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Properties-in-Checkstyle-configuration-file-get-automatically-resolved.gif\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Properties in Checkstyle configuration file get automatically resolved\" alt=\"Properties in Checkstyle configuration file get automatically resolved\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2018\/02\/Properties-in-Checkstyle-configuration-file-get-automatically-resolved.gif\" \/><\/a><\/p>\n<p>Please also refer to <a href=\"https:\/\/marketplace.visualstudio.com\/items\/shengchen.vscode-checkstyle\/changelog\">Checkstyle<\/a> extension home page to view all the convenient commands that you can use to configure your Checkstyle.<\/p>\n<h2>Maven<\/h2>\n<p>We\u2019ve also released our latest <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-maven\">Maven<\/a> 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.<\/p>\n<h2>Try it out<\/h2>\n<p>Please don\u2019t hesitate to have a try using VS Code, a lightweight code editor, for your Java development and let us know your feedback!<\/p>\n<ul>\n<li>Install the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-java-debug\">Java Extension Pack<\/a> which includes <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=redhat.java\">Language Support for Java(TM) by Red Hat<\/a>, <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-java-debug\">Debugger for Java<\/a><\/li>\n<li>Install the extensions mentioned in this blog individually based on your needs. In case you\u2019re working on Spring Boot, there&#8217;s also great support provided by <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=Pivotal.vscode-boot-dev-pack\">Pivotal<\/a> and <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vscjava.vscode-spring-initializr\">Microsoft<\/a> available on VS Code.<\/li>\n<li>Learn more about <a href=\"https:\/\/code.visualstudio.com\/docs\/languages\/java\">Java on Visual Studio Code<\/a>.<\/li>\n<li>Explore our step by step <a href=\"https:\/\/code.visualstudio.com\/docs\/java\/java-tutorial\">Java Tutorials on VS Code<\/a>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Hot code replacement (HCR), which doesn&#8217;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, [&hellip;]<\/p>\n","protected":false},"author":668,"featured_media":227205,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[15],"tags":[12],"class_list":["post-16275","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vscode","tag-visual-studio-code"],"acf":[],"blog_post_summary":"<p>Hot code replacement (HCR), which doesn&#8217;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, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/16275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/comments?post=16275"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/posts\/16275\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media\/227205"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/media?parent=16275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/categories?post=16275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/java\/wp-json\/wp\/v2\/tags?post=16275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}