Visual Studio for Java CheatSheet

Welcome, Java developers, to my Visual Studio CheatSheet for Java developers which contains the basic commands you will need to get started and develop Java applications using Visual Studio Community edition-

Visual Studio Overview

In recent times, Visual Studio has increased in popularity among Java developers, owing largely to its ever-growing ecosystem of extensions that are tailored for Java programming. The rise of extensions has therefore transformed Visual Studio into a versatile and powerful Integrated Development Environment (IDE) for Java, offering an amazing set of features and tools aimed at speeding the Java development workflow.

Before we dive into the cheatsheet, make sure you download Visual Studio Community Edition from: https://visualstudio.microsoft.com/downloads/

The CheatSheet for Visual Studio

Without further ado, here is a cheatsheet you can use as quickstart to develop Java applications with VisualStudio (You can download the PDF of it at the end of this article)

visual studio cheatsheet for Java Developers

Here are the key takeaways from it:

Java Extensions for Visual Studio

Firstly, to get started with Visual Studio and Java you need to add some extensions as Java is not a native Language for this IDE. There are several extensions available, however you don’t need to guess which are the ones you need. Now, you can install a single Extension: the Extension Pack for Java which includes a set of key extensions, each one enabling a specific aspect of your workflow:

  • Language Support for Java(TM) by Red Hat
  • Debugger for Java
  • Test Runner for Java
  • Maven for Java
  • Project Manager for Java
  • IntelliCode (AI-assisted development)

One Key Combination to rule them all !

Although Visual Studio has a rich set of configurable key combinations, you don’t need to learn them all to get started. As a matter of fact, you can begin with the most useful combination: Control + Shift + P . As you press it, you will see the Command Palette. Within it, you can browse the available commands or enter some keywords to filter:

visual studio cheatsheet

For example, if you type “JAVA” you will see some actions you can trigger using the Java extensions available such as:

  • Install a JDK
  • Configure Java Runtime
  • Create Java Projects using a starter such as Maven, Spring Boot, Quarkus, Java FX or Gradle
  • Java Tips for Beginners

Finally, I’d mention that you can also use Visual Studio native configuration file to manage your configuration. By choosing “Open User Settings” (settings.json), you can fine-tune your configuration by adding, for example some custom start-up arguments, of JVM settings:

{
"workbench.preferredDarkColorTheme": "Red",
"workbench.colorTheme": "Tomorrow Night Blue",
"java.configuration.runtimes": [
{
  "name": "JavaSE-17",
  "path": "/home/francesco/.jbang/currentjdk",
 },
 {
  "name": "JavaSE-21",
  "path": "/home/francesco/java/jdk-21",
  "default": true
 }
],
"launch": {
 "configurations": [  {
	"type": "java",
	"name": "Debug (Launch) with Arguments Prompt",
	"request": "launch",
	"mainClass": "com.sample.App",
	"args": "arg1 arg2",
	"vmArgs" : "-Xms1g -Xmx1g"
	}
],
"compounds": [] }
}

Download the CheatSheet

Download the Visual Studio CheatSheet for Java developers here: https://github.com/fmarchioni/mastertheboss/blob/master/various/cheatsheets/VisualStudioJavaCheatSheet.pdf