繁体   English   中英

在 Windows 10 上使用 Intellij IDEA 在 WSL 2 中运行和调试 Java

[英]Run and Debug Java in WSL 2 with Intellij IDEA on Windows 10

Intellij IDEA 安装在 Windows 上。 使用 maven 构建的 java 应用程序需要本机库(带有 JNI)并在 Ubuntu 上运行。

在 Windows 上使用 maven 和 git 很好。 如何让 Intellij IDEA 使用 WSL 中的 JDK,以便创建使用 WSL 的运行/调试配置?

使用 Power Shell 在 WSL 上部署您的应用,并进行远程调试

  1. 安装版本 >= 2021.1 的 Intellij IDEA。
  2. 配置 WSL。 要使用 WSL 2,您的 Windows 版本应该是 10 build 18917 或更高版本。 确保在 WSL 中添加所需的 JDK 版本。 为了使用Maven,还需要在.profile文件中添加路径变量export M2_HOME=/path/to/maven。
  3. 在相应的 WSL 环境中创建、打开和开发项目。
  4. Select 项目 SDK 作为 WSL 中配置的 JDK。
  5. 确保防火墙允许使用 WSL 进行连接。

更多详情: https://www.jetbrains.com/help/idea/2021.1/how-to-use-wsl-development-environment-in-product.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM