Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/styles/config/vocabularies/Docs/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ Cmd
DOM
IDE
JDK
JREs
MVC
LLMs
PWA
Expand Down
2 changes: 2 additions & 0 deletions articles/flow/configuration/live-reload/hotswap-agent.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ If you are using IntelliJ and the Vaadin plugin, you can launch your application

When running your application using *Debug using HotswapAgent*, the Vaadin plugin checks if you're using the proper JDK, if HotswapAgent is available, and applies additional required JVM arguments.

If you're using Eclipse IDE and the Vaadin plugin, right-click your application class and choose *Debug using Hotswap Agent*. The plugin brings its own copy of HotswapAgent and creates a debug configuration with the required JVM arguments, so the only thing you need to install is JetBrains Runtime. See <<{articles}/getting-started/dev-environment/run/eclipse#enabling-hotswap-using-the-vaadin-plugin,Run in Eclipse IDE>> for details.

If you're using VS Code and Vaadin Copilot, you can configure everything automatically from the Copilot Development Workflow guide. Follow the instruction to install the proper JDK, install the HotswapAgent library, and prepare the run configuration.

== Manual Installation
Expand Down
2 changes: 1 addition & 1 deletion articles/getting-started/dev-environment/install-ide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ If you are using IntelliJ IDEA, install the link:https://plugins.jetbrains.com/p

If you are using Visual Studio Code, install the link:https://marketplace.visualstudio.com/items?itemName=vaadin.vaadin-vscode[Vaadin extension], the link:https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack[Extension Pack for Java], and the link:https://marketplace.visualstudio.com/items?itemName=vmware.vscode-boot-dev-pack[Spring Boot Extension Pack].

If you are using Eclipse IDE, you should use the Eclipse IDE for Enterprise Java and Web Developers. Install the link:https://marketplace.eclipse.org/content/vaadin-tools[Vaadin plugin] for Copilot integration.
If you are using Eclipse IDE, you should use the Eclipse IDE for Enterprise Java and Web Developers. Install the link:https://marketplace.eclipse.org/content/vaadin-tools[Vaadin plugin] for Copilot integration and for <<run/eclipse#enabling-hotswap-using-the-vaadin-plugin,running your application with Java hotswap>>.
57 changes: 43 additions & 14 deletions articles/getting-started/dev-environment/run/eclipse.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Eclipse IDE
page-title: How to run a Vaadin application in Eclipse IDE.
meta-description: Run and debug your Vaadin application in Eclipse IDE, with step-by-step instructions for enabling Java hotswap using JetBrains Runtime and HotswapAgent.
meta-description: Run and debug your Vaadin application in Eclipse IDE, and enable Java hotswap with the Vaadin plugin for Eclipse or a manual JetBrains Runtime setup.
order: 100
---

Expand All @@ -15,17 +15,32 @@ image::images/eclipse-debug-menu.png[Eclipse IDE debug menu]
Now click menu:Debug As[Java Application]. The application starts up and you can access it at http://localhost:8080. Hot deploy of the frontend files is enabled automatically. However, to enable Java hotswap, you have to take some additional actions.


== Enabling Hotswap
== JetBrains Runtime

Enabling hotswap manually consists of three steps:
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. You can download the latest version from the https://github.com/JetBrains/JetBrainsRuntime/releases[JetBrains GitHub release page]. Be sure to select the correct architecture. Use JetBrains Runtime to execute your application, not necessarily your IDE.

1. Download and install JetBrains Runtime;
2. Download HotswapAgent and install it into JetBrains Runtime; and
3. Create a debug configuration for Eclipse IDE that runs the application with JetBrain Runtime and additional JVM parameters.

=== JetBrains Runtime
[[enabling-hotswap-using-the-vaadin-plugin]]
== Enabling Hotswap Using the Vaadin Plugin

The easiest way of running a Vaadin application with hotswap in Eclipse IDE is by installing the link:https://marketplace.eclipse.org/content/vaadin-tools[Vaadin plugin] 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 [filename]`.vaadin/eclipse-plugin/hotswap-agent.jar` in your home directory, so the only thing you have to install yourself is JetBrains Runtime. The plugin picks up any JetBrains Runtime that Eclipse IDE knows about. If it can't find one, add it on the menu:Java[Installed JREs] page in menu:Window[Preferences] (Windows) or menu:Eclipse[Preferences] (Mac).

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

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.

You can download the latest version from the https://github.com/JetBrains/JetBrainsRuntime/releases[JetBrains GitHub release page]. Be sure to select the correct architecture. Use JetBrains Runtime to execute your application, not necessarily your IDE.
Once the application is running, continue with <<verifying-the-setup,Verifying the Setup>>. You don't need the manual steps described next.


== 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>>.


=== HotswapAgent
Expand All @@ -37,7 +52,8 @@ Download the JAR file and place it inside the JetBrains Runtime installation dir
If you want to know more about the features of HotswapAgent, the documentation in the https://hotswapagent.org/[HotswapAgent webpage] is a good resource.


== Debug Configuration
[[debug-configuration]]
=== Debug Configuration

Select menu:Debug[Debug Configurations], indicated by a red rectangle on this screenshot:

Expand All @@ -50,6 +66,19 @@ In the *Debug Configurations* window, select the *Application* configuration. Go
-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 [filename]`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::images/eclipse-debug-config-arguments.png[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 [guibutton]*Installed JREs* and add it manually.
Expand All @@ -58,15 +87,15 @@ image::images/eclipse-debug-config-jre.png[Eclipse IDE debug configurations wind

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


[[verifying-the-setup]]
== 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::images/copilot-development-workflow-eclipse.png[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*. Your browser should look something like this:

image::images/copilot-development-workflow-eclipse2.png[Vaadin Copilot development workflow dialog]

The first item is orange because Vaadin does not have an official plugin for Eclipse IDE. However, Java hotswap is enabled.
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.
Binary file not shown.
Loading