Operations 21 min read

How to Run Java Projects in IDEA 2021.3 Using WSL, SSH, and Docker

This article walks through configuring IntelliJ IDEA 2021.3 to run and debug Java applications on remote environments using WSL, SSH, and Docker, detailing the setup steps, required JDK configuration, and practical tips for seamless remote execution.

Java Backend Technology
Java Backend Technology
Java Backend Technology
How to Run Java Projects in IDEA 2021.3 Using WSL, SSH, and Docker

Introduction

After updating to IntelliJ IDEA 2021.3 I explored the new support for WSL, SSH and Docker, which allows running and debugging Java applications on remote environments without extensive configuration.

Key New Features

Space integration (not used in this tutorial)

Java 16 support (not needed for the examples)

Improved Git support

Windows taskbar support

Code With Me

WSL, SSH, Docker run targets

Running on WSL

Set up JDK and JAVA_HOME inside WSL, then create a new “WSL” Run/Debug configuration in IDEA. Choose the desired distribution; a green “successfully” indicates the target is ready. After that the project runs exactly like a local execution.

设置 Run On
设置 Run On
选择 WSL 发行版
选择 WSL 发行版
额外的一些配置
额外的一些配置

Running on SSH

Configure SSH credentials, create a new SSH Run Target, specify the remote directory and JAVA_HOME, then run or debug. Note that without rsync each execution uploads all class files and dependencies.

SSH Run Target
SSH Run Target

Running on Docker

Create a simple Dockerfile (e.g., FROM openjdk:11.0.11-oraclelinux7), add a Docker Run Target, select the local Docker server, and use the Dockerfile. After the container starts, IDEA shows the mapped port and the application runs normally.

Docker 服务的设置
Docker 服务的设置
Docker server setting
Docker server setting
Docker run success
Docker run success

Conclusion

With minimal configuration, WSL, SSH and Docker run targets behave like local execution, providing full Run and Debug capabilities. Upgrading to IDEA 2021.3 is recommended for developers who need these remote development features.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerIntelliJ IDEAremote debuggingWSLSSH
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.