Java Features

Code Refactoring

With Codenvy, you can rename classes, variables and fields without breaking the code and changing its functionality. The refactoring feature is available at Edit menu or can be called with Alt+Shift+R hotkey (make sure your hotkeys are properly configured. See: Using Keyboard Shortcuts).

warning Alt+Shift+R hotkey is unavailable in Chrome. Please, use Rename command from the Edit menu.

  • set the cursor on the class, variable or a field you want to rename (Java class in the below example), go to Edit > Refactor menu or use Alt+Shift+R hotkey
  • enter a new name for the class and click on Rename


  • Codenvy will need a few seconds to rename the class and update project structure. Once the project is updated, the class will have a new name wherever it is used, including Project/Package explorer


You might want to take a quick look at the below video demonstrating convenience of Refactoring in Codenvy.

Code Outline

Code Outline is available for most file types. It opens automatically once the file has been created or opened. To enable/disable Outline click on outline icon on the toolbar or go to View > Outline.

This feature opens a vertical panel on the right presenting an outline of the file’s structure, allowing you to navigate through the file.

For instance, Code Outline for a Java class will show you packages, import declarations and methods. Click on any string in the Outline tab and you will see that the corresponding line code is highlighted. (see screenshot below).


Here’s another example. This time it’s the pom.xml file of a simple Java Spring project.


Error Marking

Error marking – underlining, icons and prompts – will help you fix errors more efficiently. By default, error marking is off. It can be enabled at Project > Show Syntax Error Highlighting.

Non-critical errors are marked with yellow icons bulb placed opposite the lines that contain errors. Wavy underlining is used directly in the editor to draw your attention to exact parts of the code that need editing. In the example below, an unused import statement is emphasized:


If you click on this yellow bulb, you will some suggestions to fix the error. You can double click on any of the options or fix the error manually.


Critical errors are marked with bulb_red icons. As long as as you have unresolved critical errors, bulb icons will be invisible to let you focus on those critical error. In addition to bulb_red icons, red wavy underlining is used to mark the problematic portion of your code.


Code Autocompletion

Codenvy supports code auto-completion for Java. The auto-completion command is called by the Ctrl+Space key combination.

The example below demonstrates autocompletion for an import declaration in a Java class file:


While auto-completing, you can view the javadoc by leaving the cursor on the method or class for a few seconds :


Package Explorer

The Package Explorer view is specific to Java projects. It organizes projects by folders, packages, class files, referenced libraries and other files. The Package Explorer view opens automatically when a Java project is opened/created. To switch off a Package view click on package_explorer icon on the toolbar or go to Window > Show View > Package Explorer

Take a quick look at this video showing the Package Explorer View in action.

Publishing JAR Projects and Managing Project Dependencies

You can create and publish Java libraries (i.e. JAR projects) and re-use them in other Java projects.

  • create a JAR project or open an existing one.
  • go to Project > Build and Publish. This process might take a moment. The result will be displayed in the Output tab (dependency details and download URL of your artifact)

The library is now published and can be used in other projects.

      • open or create a new project
      • get to its pom.xml file
      • add a new dependency (either from the library you have previously created (see the screenshot above) or from any other publicly available libraries), for example:
      • save the project
      • update the dependency at Project > Update Dependency

Here’s a short video demonstrating how to build and publish Java Libraries and use them in other projects:

Using JRebel

Currently, JRebel is unavailable
JRebel Plugin makes it possible to see code changes without redeploying your application.

When choosing a template for your Java project, you will see the JRebel checkbox.


      • Check the box, complete the form, click Finish and open your project.
      • Run your app from Run menu.
      • Make changes to the code, save the project and Update the app from the Run menu.

The JRebel plugin monitors class files and resources to update them almost instantly. No redeployment means time savings.

Here’s a detailed video demonstrating the power of JRebel:

Clone a Multi Module Project

You can clone a project consisting of more than one module (jar+war packaging, for example) from a remote repo, build and publish the entire project and publish its modules independently. For more details about cloning remote repositories visit Git section of this User Guide.

Once a multi module project is successfully cloned you can:

      • first off, build and publish the entire project
      • build each module separately one by one


In the below video you will find some additional information on multi module project support in Codenvy:

Code Folding

With Codenvy, it’s possible to fold and unfold chunks of code in Java class files to have a better code view. See screenshots below:



Folding is automatically applied to comments, imports, methods and nested classes, but it’s also possible to fold code selection manually. To do so, select a chunk of code you want to fold and go to Edit > Fold Selection.

Block Comments

You can add comments in Java class files, with two types of comments currently supported:

      • //sample text, where the compiler ignores any text after from // till the end of line. Go to Edit > Toggle Comment


      • /*sample text*/, where compiler ignores any text between /* tags. Go to Edit > Add Block Comment


You can delete block comments at Edit > Remove Block Comment
Up ↑