> Markdown version of [Eclipse IDE](https://vaadin.com/docs/next/getting-started/dev-environment/run/eclipse). Section index: [llms.txt](https://vaadin.com/docs/next/getting-started/llms.txt)

# Run in Eclipse IDE

You can run and debug your Vaadin application in Eclipse IDE as you would any other Java application. Open the main `Application` class. Then click the **Debug** button in the toolbar indicated by a red circle in this screenshot:

[Image: Eclipse IDE debug menu]

Now click **Debug As** **›** **Java Application**. The application starts up and you can access it at <http://localhost:8080>. Changes to stylesheets are applied to the browser automatically. However, to enable Java hotswap, you have to take some additional actions.

## <a id="jetbrains-runtime"></a>JetBrains Runtime

Whichever way you enable hotswap, the application has to run on JetBrains Runtime, because hotswap of Java classes needs the enhanced class redefinition that it provides. Use JetBrains Runtime to execute your application, not necessarily your IDE.

If you use the Vaadin plugin, you don’t have to install it yourself: the plugin offers to download a JetBrains Runtime when it can’t find one, as described in the next section. For the manual setup, download the latest version from the [JetBrains GitHub release page](https://github.com/JetBrains/JetBrainsRuntime/releases). Be sure to select the correct architecture.

## <a id="enabling-hotswap-using-the-vaadin-plugin"></a>Enabling Hotswap Using the Vaadin Plugin

The easiest way of running a Vaadin application with hotswap in Eclipse IDE is by installing the [Vaadin plugin](https://marketplace.eclipse.org/content/vaadin-tools) from the Eclipse Marketplace. If you haven’t done so already, do it now. Use the Eclipse IDE for Enterprise Java and Web Developers package. The same plugin also integrates Eclipse IDE with Vaadin Copilot, so that changes you make in the browser are written to your sources through the IDE.

The plugin bundles HotswapAgent and installs it for you as `.vaadin/eclipse-plugin/hotswap-agent.jar` in your home directory, and it takes care of JetBrains Runtime as well, so there’s nothing else to install.

To start the application, right-click the main `Application` class in the project navigator and click **Debug As** **›** **Debug using Hotswap Agent**. If you can’t see this option, the Vaadin plugin has not been installed correctly.

When you start the launch, the plugin looks through the JREs that Eclipse IDE knows about for a JetBrains Runtime that matches the Java version your project requires. If it doesn’t find one, it opens a **JetBrains Runtime Required** dialog:

- **Download JetBrains Runtime**

  Fetches the latest release for your operating system and processor architecture. The download is a few hundred megabytes, so it runs in a progress dialog that you can cancel. The runtime is installed as `.vaadin/jdk` in your home directory, the same location that the Vaadin plugins for IntelliJ IDEA and Visual Studio Code use, so it’s downloaded only once per machine. It’s also added to the **Java** **›** **Installed JREs** page, so that later launches reuse it. Should the newest JetBrains Runtime be older than your project requires, the plugin tells you instead of starting without it.

- **Continue Without JBR**

  Starts the application on a regular JVM. Only changes to method bodies are hotswapped then; adding or removing methods and fields still requires a restart.

To use a JetBrains Runtime that you installed yourself, add it on the **Java** **›** **Installed JREs** page in **Window** **›** **Preferences** (Windows) or **Eclipse** **›** **Preferences** (Mac) before you start the launch. The plugin then uses that one and doesn’t download anything.

The plugin creates a debug configuration named `Application [Hotswap]` that runs the application on JetBrains Runtime, starts the bundled HotswapAgent with a `-javaagent` parameter, and adds the other JVM parameters that hotswap needs. Because the agent comes from the plugin, you don’t have to install it into JetBrains Runtime, and the parameters listed in [Debug Configuration](#debug-configuration) are needed only for the manual setup. You can reuse the configuration later from the **Debug** button in the toolbar.

Once the application is running, continue with [Verifying the Setup](#verifying-the-setup). You don’t need the manual steps described next.

## <a id="enabling-hotswap-manually"></a>Enabling Hotswap Manually

If you prefer not to install the Vaadin plugin, you can set up hotswap by hand. This consists of three steps:

1. Download and install JetBrains Runtime, as described above;

2. Download HotswapAgent and install it into JetBrains Runtime; and

3. Create a debug configuration for Eclipse IDE that runs the application with JetBrains Runtime and the `-XX:+AllowEnhancedClassRedefinition`, `-XX:+ClassUnloading`, and `-XX:HotswapAgent=fatjar` JVM parameters, as described in [Debug Configuration](#debug-configuration).

### <a id="hotswapagent"></a>HotswapAgent

You can download HotswapAgent from the [HotswapAgent GitHub release page](https://github.com/HotswapProjects/HotswapAgent/releases). You’ll need version 1.4.2 or later.

Download the JAR file and place it inside the JetBrains Runtime installation directory as `lib/hotswap/hotswap-agent.jar`. You’ll need to create the `hotswap` folder, and rename the downloaded file to `hotswap-agent.jar`.

If you want to know more about the features of HotswapAgent, the documentation in the [HotswapAgent webpage](https://hotswapagent.org/) is a good resource.

### <a id="debug-configuration"></a>Debug Configuration

Select **Debug** **›** **Debug Configurations**, indicated by a red rectangle on this screenshot:

[Image: Eclipse IDE debug menu]

In the **Debug Configurations** window, select the **Application** configuration. Go to the **Arguments** tab. In the **VM arguments** field, copy-paste the following:

```
-XX:+AllowEnhancedClassRedefinition -XX:+ClassUnloading -XX:HotswapAgent=fatjar
```

These parameters do the following:

- `-XX:+AllowEnhancedClassRedefinition`

  Enables the enhanced class redefinition of JetBrains Runtime. This is what allows changes such as added or removed methods and fields to be hotswapped; a standard JVM can only redefine method bodies.

- `-XX:+ClassUnloading`

  Keeps class unloading enabled, so that classes the JVM no longer needs after a redefinition can be garbage collected. This is the default setting of the JVM; it’s passed explicitly to be sure that it isn’t turned off elsewhere.

- `-XX:HotswapAgent=fatjar`

  Starts the HotswapAgent that you installed as `lib/hotswap/hotswap-agent.jar`, including the plugins bundled with it.

These are JVM parameters, so they belong in the **VM arguments** field — not in the **Program arguments** field.

[Image: Eclipse IDE debug configurations window with the Arguments tab selected]

Next, go to the **JRE** tab. From the **Alternate JRE** select box, select **JetBrains Runtime**. If you can’t find it in the list, click **Installed JREs** and add it manually.

[Image: Eclipse IDE debug configurations window with the JRE tab selected]

Click **Apply**, then start the application by clicking **Debug**. The application starts up.

## <a id="verifying-the-setup"></a>Verifying the Setup

Open the application in a browser and verify that everything is working through Vaadin Copilot. Move your mouse pointer over the **Copilot** button at the bottom-right corner:

[Image: Vaadin Copilot menu visible in a browser]

> **Important:** The Copilot button is only available when the application is running in development mode. It is not available in production mode.

Now click **Development workflow**. Copilot reports the state of the Eclipse IDE integration and of Java hotswap. Both should be green when the Vaadin plugin is installed and the application was started with hotswap enabled. If the Eclipse IDE item is orange, the plugin is either not installed or not running; if the hotswap item is orange, the application isn’t running on JetBrains Runtime with HotswapAgent.
