Intellij Idea用什么JVM来启动?

时间:2021-06-17 04:47:27

I am an Eclipse user that recently decided to try Intellij Idea. My OS is Ubuntu 12.

我是一个Eclipse用户,最近决定尝试Intellij Idea。我的操作系统是Ubuntu 12。

Working with Eclipse it was easy to choose a JVM used to start Eclipse by specifying it in eclipse.ini (http://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM). But I cannot find such a thing for Intellij Idea 12.

通过使用Eclipse,可以很容易地选择一个JVM,通过在Eclipse中指定它来启动Eclipse。ini(http://wiki.eclipse.org/Eclipse.ini # Specifying_the_JVM)。但是对于Intellij Idea 12,我找不到这样的东西。

Thus, I have 2 questions:

因此,我有两个问题:

  1. How does Intellij Idea determine what JVM to use to start itself?
  2. Intellij是如何决定用什么JVM来启动自己的呢?
  3. Is there a way to override this default behavior?
  4. 是否有方法覆盖这个默认行为?

Thank you.

谢谢你!

3 个解决方案

#1


9  

From the idea.sh you run

从这个想法。上海你跑

# ---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
# Try (in order): IDEA_JDK, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------
if [ -n "$IDEA_JDK" -a -x "$IDEA_JDK/bin/java" ]; then
  JDK="$IDEA_JDK"
elif [ -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
  JDK="$JDK_HOME"
elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
  JDK="$JAVA_HOME"
else
  JAVA_BIN_PATH=`which java`
  if [ -n "$JAVA_BIN_PATH" ]; then
    if [ "$OS_TYPE" = "FreeBSD" ]; then
      JAVA_LOCATION=`JAVAVM_DRYRUN=yes java | "$GREP" '^JAVA_HOME' | "$CUT" -c11-`
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    elif [ "$OS_TYPE" = "SunOS" ]; then
      JAVA_LOCATION="/usr/jdk/latest"
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    elif [ "$OS_TYPE" = "Darwin" ]; then
      JAVA_LOCATION=`/usr/libexec/java_home`
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    fi

    if [ -z "$JDK" -a -x "$READLINK" ]; then
      JAVA_LOCATION=`"$READLINK" -f "$JAVA_BIN_PATH"`
      case "$JAVA_LOCATION" in
        */jre/bin/java)
          JAVA_LOCATION=`echo "$JAVA_LOCATION" | xargs dirname | xargs dirname | xargs dirname` ;;
        *)
          JAVA_LOCATION=`echo "$JAVA_LOCATION" | xargs dirname | xargs dirname` ;;
      esac
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    fi
  fi
fi

#2


3  

IntelliJ IDEA is shipped with its own JDK. Try to look in $IDEA_HOME/bin directory for idea.sh or smth like that. You can use it for tuning.

IntelliJ IDEA是用它自己的JDK附带的。尝试在$IDEA_HOME/bin目录中查找idea。像这样。您可以使用它进行调优。

#3


0  

Short answer: this is set by the IDEA_JDK environment variable.

简短的回答:这是由IDEA_JDK环境变量设置的。

#1


9  

From the idea.sh you run

从这个想法。上海你跑

# ---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
# Try (in order): IDEA_JDK, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------
if [ -n "$IDEA_JDK" -a -x "$IDEA_JDK/bin/java" ]; then
  JDK="$IDEA_JDK"
elif [ -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
  JDK="$JDK_HOME"
elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
  JDK="$JAVA_HOME"
else
  JAVA_BIN_PATH=`which java`
  if [ -n "$JAVA_BIN_PATH" ]; then
    if [ "$OS_TYPE" = "FreeBSD" ]; then
      JAVA_LOCATION=`JAVAVM_DRYRUN=yes java | "$GREP" '^JAVA_HOME' | "$CUT" -c11-`
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    elif [ "$OS_TYPE" = "SunOS" ]; then
      JAVA_LOCATION="/usr/jdk/latest"
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    elif [ "$OS_TYPE" = "Darwin" ]; then
      JAVA_LOCATION=`/usr/libexec/java_home`
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    fi

    if [ -z "$JDK" -a -x "$READLINK" ]; then
      JAVA_LOCATION=`"$READLINK" -f "$JAVA_BIN_PATH"`
      case "$JAVA_LOCATION" in
        */jre/bin/java)
          JAVA_LOCATION=`echo "$JAVA_LOCATION" | xargs dirname | xargs dirname | xargs dirname` ;;
        *)
          JAVA_LOCATION=`echo "$JAVA_LOCATION" | xargs dirname | xargs dirname` ;;
      esac
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    fi
  fi
fi

#2


3  

IntelliJ IDEA is shipped with its own JDK. Try to look in $IDEA_HOME/bin directory for idea.sh or smth like that. You can use it for tuning.

IntelliJ IDEA是用它自己的JDK附带的。尝试在$IDEA_HOME/bin目录中查找idea。像这样。您可以使用它进行调优。

#3


0  

Short answer: this is set by the IDEA_JDK environment variable.

简短的回答:这是由IDEA_JDK环境变量设置的。