Welcome back to the June update of Java on Visual Studio Code.
We are approaching the end of the first half of 2020. In this unforgettable year, we hope you still enjoy many beautiful moments in life and, of course, enjoy the productivity VS Code brings to you. On to the update.
VS Code for Java soon requiring Java 11 to run
VS Code for Java requires the Eclipse JDT.LS server. As a result of the Eclipse Platform’s decision to require Java 11 as the minimum requirement for its September 2020 release, that same requirement will apply to VS Code for Java. We expect the requirement will become effective as early as July 2020 for running VS Code for Java. This is a CALL FOR ACTION to make sure your VS Code for Java runs on Java 11 or above versions before the time comes. For more details on how to check and upgrade, please refer to Configuring your development environment to use a JDK.
Please note, this is NOT a requirement to migrate your projects to Java 11. VS Code for Java will still be possible to compile and run Java applications from Java 1.5 to 14.
Introducing Java pack installer for MacOS
There are many ways to install and set up your Java development environment on VS Code. To help you get started quickly, back to a year ago, we introduced a Java pack installer for Windows, which includes all the necessary dependencies and extensions for Java development on Visual Studio Code. Today, the installer is available on MacOS as well. You can use the installer for a clean installation or an update to existing VS Code environment to add Java support.
For more information on installing and setting up your Java development on VS Code, please refer to our Get Started document.
Code completion for Lightweight Mode
Back to March, we introduced Syntax Mode, which allows you to read and navigate your source code right after open them, while their external dependencies are being resolved. Since that, we have received positive feedback from our developers. Today, we are sharing two news. Syntax mode now supports code completion. Previously, code completion is available only until projects are fully resolved. With this enhancement, code completion will be enabled in about 10 seconds after you open a fresh workspace. In addition, we are renaming Syntax Mode to Lightweight Mode. In transition, you will see both names used interchangeably.
For more information about Lightweight Mode (a.k.a., Syntax Model), please refer to Project Management document.
Other enhancements
In June, we released new versions of Maven for Java and Java Test Runner extensions. On Maven for Java, we improved support for PowerShell and fixed a couple of issues. On Java Test Runner, we started to support JUnit 5’s @Testable in Code Lenses. For details, please refer to Maven for Java and Java Test Runner.
FAQ: add jar or classpath
We have received questions around how to add jar or classpath. Actually, VS Code provides flexibility on how, which depends on your project type. As a summary, adding jar or classpath is supported through:
- Maven: Supported by Maven extension
- Gradle: Need to manually update the build.gradle
- Eclipse: Manually update the .classpath file
- Source only: Update the Referenced Libraries in the dependency viewer’s node
In addition, you can always manually update the .classpath file regardless project type.
Try it out
Please don’t hesitate to give it a try! Your feedback and suggestions are very important to us and will help shape our product in future.
- Learn more about Java on Visual Studio Code.
- Explore our step by step Java Tutorials on Visual Studio Code.
This feature does not work out of the box for users who already have JDK 8 and the java plugin preinstalled.Read more
The VS Code plugin tells you to install Redhad OpenJDK 11 or higher, but after you install it still doen't work and also gives no clue of what needs to be done.
I had to remove JDK 8 completely, manually change environment variables, then dig through, github "CLOSED"!! issues to finally reach a solution.
We are really sorry about your experience. Please provide the link to the issue so we can continue to help you.
At the same time, the Java 11 requirement has been causing some confusion indeed. The JDK 11 is only required to start the language support, but all your projects can stay in whatever version. Our recommendation is to install JDK 11 side by side with other versions, and change "java.home" setting in VS Code to...
Thank you MS! Please, continue.
Make HCR (hotCodeReplace) much smartie and useful.
Recompile or remake bytecode at background without necessary restarting debug.session.
When JVM call obsolete methods in same class.
Currently, HCR is supported by VS Code Java Debugger. Whenever you want to apply code changes to a running JVM, just click on the thunder ⚡️ button in the debug toolbar. But this feature does have limitations due to JVM constraints. Please refer to the documentation for further details:
https://github.com/microsoft/vscode-java-debug/wiki/Hot-Code-Replace
I have a problem, I cant start a project because if I want I need to attach him
We are more than happy to help you get through. Please open an issue at:
https://github.com/Microsoft/vscode-java-pack/issues