Enhanced support for Java development - AWS Cloud9

Enhanced support for Java development

AWS Cloud9 provides enhanced language support to improve your development experience when working with Java. Key productivity features include code completion, linting for errors, code lenses, and debugging options such as breakpoints and stepping.


Enhanced productivity features are available only for AWS Cloud9 development environments that are connected to Amazon EC2 instances.

Moreover, to ensure an optimal IDE experience when using enhanced language support for Java, the Amazon EC2 compute instance that backs your AWS Cloud9 environment requires 2 GiB or more of memory. If AWS Cloud9 detects that your EC2 compute instance doesn't have sufficient RAM, you're not offered the option to activate enhanced features for Java.

Activating and customizing enhanced Java support

The option to activate enhanced support for Java is automatically displayed if the following conditions are met:

  • Your AWS Cloud9 environment is connected to an Amazon EC2 instance with 2 GiB or more of memory.

  • You're working with a file associated with Java development. AWS Cloud9 checks the following file names and extensions: *.java, *.gradle (associated with the Gradle build tool), and pom.xml (associated with the Apache Maven build tool).

  • You're working in an AWS Cloud9 environment that was created after December 11, 2020. At present, it's not possible to use Java productivity features in development environments that were created before this date.

If these conditions are met, a dialog box displays to ask you whether you want to activate the extra productivity features for coding and debugging Java. If you choose Activate, you can start using the features in the IDE.

Code completion with

Amazon EC2 instances which are launched when you create an AWS Cloud9 environment have Amazon Coretto 11 already installed. Amazon Coretto is no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK). This means you can start developing and running Java applications in AWS Cloud9 out-of-the-box.

You can also manually activate and deactivate enhanced language and debugging support using the AWS Cloud9 interface. Choose Preferences, Java Support, Enhanced Java Support.

Manually activating and deactivating enhanced Java support

The enhanced support for Java development in AWS Cloud9 is provided by two extensions to the IDE:

  • Language Support for Java(TM) by Red Hat

  • Debugger for Java

The AWS Cloud9 interface gives you access to wide range of settings that customize these extensions' performance. To change extension settings, choose Preferences, Java Support.

For detailed information on these settings, see the installed versions' ReadMe pages in the extensions' GitHub repositories:

Feature highlights

After you've activated enhanced Java support, you can use a range of productivity-boosting features.

Code completion

With code completion, the editor makes context-aware suggestions based on the code you're typing. For example, if you type the dot (".") operator after an object name, the editor displays the methods or properties available for that object.

Code completion with

Code lenses

Code lens allow you to access context-specific actions directly in the source code. For Java development, code lenses facilitate unit testing by allowing you to run and debug specific methods.

Accessing code lenses

Code linting

Code linting describes how the editor highlights potential errors in your code before you've even built it. For example, the linting tool call out if you're trying to use an uninitialized variable or trying to assign a value to a variable that's expecting a different type.

Linting highlight errors before you build your code

Debugging options

You can implement breakpoints and watch expressions. Set your breakpoints in the source code and display the debugger pane to define relevant conditions.

Debugging options

Debugging using configuration files

You can also control your debugging configuration by using launch configurations and tasks which AWS Cloud9 supports via the launch.json and tasks.json configuration files. For examples of launch configurations and how they can be used, see Java debug configuration.

Java commands

You can run commands from the AWS Cloud9 command panel by pressing Ctrl+. or F1. Then filter the relevant commands by entering "java".

Listing available Java commands

Quick fixes

With quick fixes, you can resolve errors caused by using undeclared variables or undefined methods by creating stubs for the missing elements.

Implementing a quick fix


Refactoring allows you to restructure your code without changing its behavior. To access options such as organizing imports or creating constructors, open the context (right-click) menu for the item and choose Refactoring.

Refactoring feature


Renaming is a refactoring feature that allows you to easily modify the names of selected variables, functions, and classes everywhere that they appear in the code with a single action. To change a name, open the context (right-click) menu for the item and choose Rename. Renaming affects every instance of the name in your code.

Renaming a class name

Optional tools for Java development

The extensions that provide enhanced Java support include features that allow you to integrate the Gradle and Maven automation tools into your project development. These tools aren't pre-installed in your AWS Cloud9 development environment. For more information on installing and using these optional build tools, see the following resources:

Problems tab for Java extension

You can view and troubleshoot issues with your java project within your AWS Cloud9 environment in the Problems tab of the AWS Cloud9 IDE. To display the Problems tab from the AWS Cloud9 IDE, select View and choose Problems from the menu bar.

Opening the problems tab

You can also open the Problems tab by selecting the + icon within the console and choosing Open Problems. When you select a problem from the tab, it opens the affected file and displays the issue details.