Issue
I am using Ubuntu 22.04 with windows WSL, and have installed JDK 19.01 and Maven inside this, and have imported a file from the WSL into IntelliJ Idea to work on, however once I run a class, IntelliJ "builds" for upwards of half an hour, hanging on the messages of "Executing pre-compile tasks..." and "Preparing WSL build environment...". Obviously this is a pain and I need to know how to fix it.
I've tried to reinstall my JDK in Ubuntu and set the JAVA_HOME variable, which I've checked and have no issues with. I've tried to reinstall IntelliJ, and disabled my firewall/made exceptions, and I've changed the SDK being used inside IntelliJ, all to no success.
Here are logs from inside the Ubuntu terminal showing my JDK and Maven installations:
user@user \~ mvn -v
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 19.0.1, vendor: Private Build, runtime: /usr/lib/jvm/java-19-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.10.16.3-microsoft-standard-wsl2", arch: "amd64", family: "unix"
user@user \~ javac -version
javac 19.0.1
user@user \~ java -version
openjdk version "19.0.1" 2022-10-18
OpenJDK Runtime Environment (build 19.0.1+10-Ubuntu-1ubuntu122.04)
OpenJDK 64-Bit Server VM (build 19.0.1+10-Ubuntu-1ubuntu122.04, mixed mode, sharing)
user@user \~ echo $JAVA_HOME
/usr/lib/jvm/java-19-openjdk-amd64
user@user \~ which java
/usr/bin/java
user@user \~ which javac
/usr/bin/javac
Solution
Disable the real-time antivirus monitoring. It's a known issue.
Answered By - CrazyCoder
Answer Checked By - Marilyn (JavaFixing Volunteer)