After installing dev-util/idea-community yesterday I found that it can't start, because it tries to launch itself with openjdk:8, which is my default system java-vm. The code in the launch script that checks for java VM is the following (with my commentary): if [ -n "$IDEA_JDK" ] && [ -x "$IDEA_JDK/bin/java" ]; then # This fails, IDEA_JDK is not set JRE="$IDEA_JDK" else JDK="/opt/openjdk-bin-11" && [[ -d "/opt/openjdk-11" ]] && JDK="/usr/lib64/openjdk-bin-11" # This succeeds, but JDK variable is not used anywhere fi BITS="" if [ -z "$JRE" ] && [ -s "${CONFIG_HOME}/JetBrains/IdeaIC2021.2/idea.jdk" ]; then # This fails, there;'s no file ${CONFIG_HOME}/JetBrains/IdeaIC2021.2/idea.jdk USER_JRE=$(cat "${CONFIG_HOME}/JetBrains/IdeaIC2021.2/idea.jdk") if [ -x "$USER_JRE/bin/java" ]; then JRE="$USER_JRE" fi fi if [ -z "$JRE" ] && [ "$OS_TYPE" = "Linux" ] && [ "$OS_ARCH" = "x86_64" ] && [ -d "$IDE_HOME/jbr" ]; then # This fails, there's no dir $IDE_HOME/jbr JRE="$IDE_HOME/jbr" fi # shellcheck disable=SC2153 if [ -z "$JRE" ]; then if [ -n "$JDK_HOME" ] && [ -x "$JDK_HOME/bin/java" ]; then # This succeeds, but it's Java 8, not Java 11 JRE="$JDK_HOME" elif [ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ]; then JRE="$JAVA_HOME" fi fi if [ -z "$JRE" ]; then JAVA_BIN=$(command -v java) else JAVA_BIN="$JRE/bin/java" fi if [ -z "$JAVA_BIN" ] || [ ! -x "$JAVA_BIN" ]; then message "No JRE found. Please make sure \$IDEA_JDK, \$JDK_HOME, or \$JAVA_HOME point to valid JRE installation." exit 1 fi Going by "eselect java-vm list", there's not even an option to set openjdk:11 as a system-wide VM. A workaround for that problem is to create ${CONFIG_HOME}/JetBrains/IdeaIC2021.2/idea.jdk file with the path to JDK, but caveat is you'd have to do it each and every major update. Proper fix should be replacing the line JDK="/opt/openjdk-bin-11" && [[ -d "/opt/openjdk-11" ]] && JDK="/usr/lib64/openjdk-bin-11" with JRE="/opt/openjdk-bin-11" && [[ -d "/opt/openjdk-11" ]] && JRE="/usr/lib64/openjdk-bin-11" Reproducible: Always
> > Going by "eselect java-vm list", there's not even an option to set > openjdk:11 as a system-wide VM. How about emerging openjdk:11 with the gentoo-vm use flag? # eselect java-vm list Available Java Virtual Machines: [1] openjdk-11 system-vm [2] openjdk-bin-8
(In reply to Mike Pagano from comment #1) > How about emerging openjdk:11 with the gentoo-vm use flag? That might be an option, yea. Thanks for pointing that. But I don't want to update to Java 11 system-wide yet (it's still too immature IMO) and that's still a workaround - the real issue here is a hiccup in the launch script.
(In reply to Alex from comment #2) > (In reply to Mike Pagano from comment #1) > > How about emerging openjdk:11 with the gentoo-vm use flag? > > That might be an option, yea. Thanks for pointing that. But I don't want to > update to Java 11 system-wide yet (it's still too immature IMO) and that's > still a workaround - the real issue here is a hiccup in the launch script. I suggest you enable the gentoo-vm flag and then eselect java-vm set user <N> as appropriate, and you won't have this enabled system wide.
Sorry, I missed the point where this issue was marked as "resolved" for some reason and now I'm encountering this again due to 2022.1 update. Should be fixed properly. (In reply to Mike Pagano from comment #3) > I suggest you enable the gentoo-vm flag and then eselect java-vm set user > <N> as appropriate, and you won't have this enabled system wide. I worded this wrong, my bad. I don't want to use Java 11 as any kind of "default", not as "system-vm" nor as "user-vm", but I need it for some (very few) programs. Gentoo allows this use-case: default system and user VM is Java 8, while a few programs can pick up Java 11 as they need it. IDEA can't due to the bug - it sets the wrong variable ("JDK" instead of "JRE") in the launch script. Proper fix is to patch this bug out.
(In reply to Alex from comment #4) > Sorry, I missed the point where this issue was marked as "resolved" for some > reason and now I'm encountering this again due to 2022.1 update. Should be > fixed properly. > > (In reply to Mike Pagano from comment #3) > > > I suggest you enable the gentoo-vm flag and then eselect java-vm set user > > <N> as appropriate, and you won't have this enabled system wide. > > I worded this wrong, my bad. I don't want to use Java 11 as any kind of > "default", not as "system-vm" nor as "user-vm", but I need it for some (very > few) programs. > > Gentoo allows this use-case: default system and user VM is Java 8, while a > few programs can pick up Java 11 as they need it. IDEA can't due to the bug > - it sets the wrong variable ("JDK" instead of "JRE") in the launch script. > Proper fix is to patch this bug out. Did you try what I wrote above ?
(In reply to Mike Pagano from comment #5) > (In reply to Alex from comment #4) > > Sorry, I missed the point where this issue was marked as "resolved" for some > > reason and now I'm encountering this again due to 2022.1 update. Should be > > fixed properly. > > > > (In reply to Mike Pagano from comment #3) > > > > > I suggest you enable the gentoo-vm flag and then eselect java-vm set user > > > <N> as appropriate, and you won't have this enabled system wide. > > > > I worded this wrong, my bad. I don't want to use Java 11 as any kind of > > "default", not as "system-vm" nor as "user-vm", but I need it for some (very > > few) programs. > > > > Gentoo allows this use-case: default system and user VM is Java 8, while a > > few programs can pick up Java 11 as they need it. IDEA can't due to the bug > > - it sets the wrong variable ("JDK" instead of "JRE") in the launch script. > > Proper fix is to patch this bug out. > > Did you try what I wrote above ? It sounds like you need a different way for Gentoo to handle java vm. I suggest possibly describing your issue in a new bug for the java team
> > Did you try what I wrote above ? No, because that's not my point. > It sounds like you need a different way for Gentoo to handle java vm. > I suggest possibly describing your issue in a new bug for the java team No, I don't have anything I can suggest to the Java team. I just want someone with write access to the Gentoo repo to fix the variable name in the launch script of IDEA, because that's what causing this incorrect behaviour. That's it. If you can't fix this issue, please don't mark it as "RESOLVED".
Created attachment 778133 [details, diff] Reqired fix
Maybe propose this upstream
(In reply to Mike Pagano from comment #9) > Maybe propose this upstream I've chosen to propose it here. I even provided a patch. Please, DO NOT CLOSE this issue UNLESS you fix it. Period.