RFR: 8269761: idea.sh missing .exe suffix when invoking javac on WSL [v3]

Jorn Vernee jvernee at openjdk.java.net
Mon Jul 5 11:00:54 UTC 2021

On Mon, 5 Jul 2021 10:40:15 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> From the JBS issue:
>> At the end, idea.sh tries to invoke javac, but when running on WSL this results in the following error:
>>     bin/idea.sh: line 249: /mnt/c/progra~1/java/jdk-16/bin/javac: No such file or directory
>> Adding a .exe suffix to the javac path fixes this issue, which can be done just for WSL.
> Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>  - Merge branch 'master' into Idea_Exe
>  - Add .exe suffix when invoking javac on WSL
>  - use CYGPATH variable instead of calling cygpath directly
>  - Allow specifying conf to idea.sh

Hmm, now that I'm looking again, I see that an earlier block also tries to set `JAVAC` to `javac.exe` on WSL, but it never gets executed because `CYGPATH` is set in my environment:

if [ "x$CYGPATH" != "x" ] ; then ## CYGPATH may be set in env.cfg
elif [ "x$WSL_DISTRO_NAME" != "x" ]; then

Of course, when I remove my fix, and move the `"x$WSL_DISTRO_NAME" != "x"` to the front, this also fails on a linux boot JDK because `javac.exe` doesn't exist. If I remove the `.exe` suffix then the usage of `realpath` in that same block makes the script work on a linux boot JDK, but fails again on a Windows boot JDK because of the missing .exe suffix.

I'll try to see if I can make the existing logic work on both JDK types


PR: https://git.openjdk.java.net/jdk/pull/4656

More information about the ide-support-dev mailing list