News

VS Code Java Team Details 5 Best Dev Practices

Microsoft's Visual Studio Code team for Java development added a new Coding Pack for Java installer and detailed best practices for setting up a development environment.

Support for Java in Visual Studio Code is provided through a wide range of extensions, many of which are bundled in the Java Extension Pack.

Coding Pack for Java
[Click on image for larger view.] Coding Pack for Java (source: Microsoft).

The new Coding Pack for Java, meanwhile, installs VS Code, the AdoptOpenJDK Java Development Kit (JDK) and the "essential Java extensions" found in the Java Extension Pack. It can be used for a brand-new clean installation or for updating or repairing an existing development environment. The installer is available for Windows and for macOS, but be warned that clicking on those links may start an automatic download.

Along with announcing the new Coding Pack for Java installer, Yaojin Yang, senior program manager in the Developer Division at Microsoft, detailed five best practices for initial setup of a development environment, starting off with using the Coding Pack for Java. "When installation completes, you immediately have an integrated environment for your Java projects," he said. "The pack supports incremental updates by checking your environment firstly and only installs required pieces."

After explaining how VS Code uses two JDKs, boot (for running VS Code for Java) and project (for building projects), Yang listed other best practices including:
  • Check the "java.home" VS Code setting to ensure it points to a JDK with Java 11 or above if you have trouble with running VS Code for Java. To access that setting click on the menu item titled "File->Preferences->Settings" and search for "java.home" on the "User" tab.
  • Configure your project JDK using the VS Code setting "java.configuration.runtimes" found by clicking on the "File->Preferences->Settings" menu item and searching for "java.configuration.runtimes" on the "User" tab. "You can set multiple JDK versions, and VS Code will pick the best version per your default or project’s source level," Yang said.
  • Install the Java Extension Pack instead of installing individual extensions if you are coding on a Linux machine and thus can't use the Coding Pack for Java installer or otherwise just want to follow a manual process instead.
  • Use the Extension Guide for functionality not found in the Java Extension Pack, including adding more framework support, application server support or utility functions. To launch the wizard-like guide that recommends and installs extensions for specific functionality, click the "View->Command Palette ..." menu item and type in "Java: Extension Guide" in the pallette, which can also be launched by the CTRL+Shift+P keyboard command sequence.

Yang also provided advice on using the Project View that was introduced back in August along with the Extension Guide as part of an effort to improve the "getting started" experience.

See Yang's Oct. 15 blog post for more details on the above, along with advice for using different options to trigger "run or debug" and useful documentation such as:

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • See Prompts Microsoft Engineers Use for Bleeding-Edge Multimodal RAG AI Research

    Vision-centric queries show how front-line experts are prompting LLMs these days.

  • AI Explains Expressions in Update to Java on VS Code

    "The Spring Tools now show code lenses above these expressions that allow you to quickly let GitHub Copilot explain those statements for you."

  • Microsoft Eases Integration with Semantic Kernel AI SDK

    The basic idea is to provide unified API abstractions, especially for idiomatic C# code, to help platform developers and others work with any provider with standard implementations for caching, telemetry, tool calling and other common tasks.

  • Final .NET 9 Preview Ships with Go-Live License

    Visual Studio developers can now download the SDK for .NET 9 Release Candidate 2 with a go-live license, meaning devs get Microsoft support for production applications even before the framework reaches general availability next month.

Subscribe on YouTube