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 at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube