Java on Visual Studio Code Update – June 2020

Yaojin Yang

Yaojin

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.

Image code completion for lightweight mode

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.

6 comments

Leave a comment

  • Maynard Keynes
    Maynard Keynes

    This feature does not work out of the box for users who already have JDK 8 and the java plugin preinstalled.
    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.
    I had to manually change the java.home in the settings.json on the VS Code plugin.
    Really??? Is this how you release software?? Ignore open issues and close just close them on github then hope users will somehow cope??

    • Avatar
      Rong LiMicrosoft logo

      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 make it point to JDK 11 installation. With that, the impact of the new version is limited to the language support only. All you system environment like “JAVA_HOME” remain unchanged.