When I run this command in cmd it executes without issue:

C:\Users\mysig\.jdks\openjdk-21.0.1\bin\java.exe --enable-preview "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2023.3.1\lib\idea_rt.jar=57407:C:\Program Files\JetBrains\IntelliJ IDEA 2023.3.1\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\Users\mysig\dev\projects\myProject\out\production\myProject;C:\Users\mysig\dev\projects\myProject\lib\annotations-24.0.0.jar Main

But when I try to rewrite it as a Git Bash command and run it in the Git Bash terminal I'm getting:

$ "C:\Program Files\Git\bin\bash.exe" C:/Users/mysig/dev/projects/myProject/run.sh
Launcher failed - "Dump Threads" and "Exit" actions are unavailable (For input string: "55310;C")

Here is my run.sh file:

#!/bin/bash

JAVA_HOME="/c/Users/mysig/.jdks/openjdk-21.0.1/bin"
IDEA_LIB="/c/Program Files/JetBrains/IntelliJ IDEA 2023.3.1/lib"
IDEA_BIN="/c/Program Files/JetBrains/IntelliJ IDEA 2023.3.1/bin"
PROJECT_OUT="/c/Users/mysig/dev/projects/myProject/out/production/myProject"
PROJECT_LIB="/c/Users/mysig/dev/projects/myProject/lib/annotations-24.0.0.jar"

"$JAVA_HOME/java.exe" --enable-preview \
-javaagent:"$IDEA_LIB/idea_rt.jar=55310:$IDEA_BIN" \
-Dfile.encoding=UTF-8 \
-Dsun.stdout.encoding=UTF-8 \
-Dsun.stderr.encoding=UTF-8 \
-classpath "$PROJECT_OUT:$PROJECT_LIB" \
Main

I was able to resolve the issue by using cygpath:

#!/bin/bash


JAVA_HOME="/c/Users/mysig/.jdks/openjdk-21.0.1/bin/java.exe"
IDEA_JAR="/c/Program Files/JetBrains/IntelliJ IDEA 2023.3.1/lib/idea_rt.jar"
IDEA_BIN="/c/Program Files/JetBrains/IntelliJ IDEA 2023.3.1/bin"
PROJECT_PATH="/c/Users/mysig/dev/projects/myProject"
LIB_PATH="$PROJECT_PATH/out/production/myProject:$PROJECT_PATH/lib/annotations-24.0.0.jar"
MAIN_CLASS="Main"

"$JAVA_HOME" --enable-preview \
    "-javaagent:$(cygpath -w "$IDEA_JAR")=57407:\"$(cygpath -w "$IDEA_BIN")\"" \
    -Dfile.encoding=UTF-8 \
    -Dsun.stdout.encoding=UTF-8 \
    -Dsun.stderr.encoding=UTF-8 \
    -classpath "$LIB_PATH" "$MAIN_CLASS"

What I'd like to know is, is cygpath necessary, or is there a much simpler way of fixing the issue I'm having with that line. It seems to just be a parsing issue with the way it's being read, so I figured I'd just need write it with the correct syntax, but I can only manage to get it to work with cygpath.

0

There are 0 best solutions below