尝试运行pycharm-community-4.5时出现Java问题


9

我刚刚在我的Ubuntu 14.04(64位)中安装了pycharm-community-4.5。安装后,我运行了命令/opt/pycharm-community-4.5/bin$ ./pycharm.sh以运行pycharm,但是终端向我显示了一些错误,如下所示:

Unrecognized VM option MaxPermSize=350m
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

这是我的结果java -version

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

我如何解决它?


Java,万恶之源。
Virusboy

:(无关。
阿卜杜拉·伊姆兰

MaxPermSize支持已在Java 8.0中删除。但是我找不到条目。中的条目pycharm.vmoptions似乎无效。我已经下载了最新的PyCharm版本,并且可以在Ubuntu 15.04中使用。没有变化。
AB

PyCharm安装中是否有Java?该错误消息看起来不像Oracle Java或OpenJDK。
AB

编辑您的问题,并增加输出echo "$PYCHARM_JDK"
AB

Answers:


8

开启档案 pycharm64.vmoptions

nano /opt/pycharm-community-4.5/bin/pycharm64.vmoptions

#在行首添加

# -XX:MaxPermSize=350m

开启档案 pycharm.vmoptions

nano /opt/pycharm-community-4.5/bin/pycharm.vmoptions

#在行首添加

# -XX:MaxPermSize=250m

MaxPermSize支持已在Java 8.0中删除,但错误消息

Unrecognized VM option MaxPermSize=350m
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

看起来不像Oracle Java 8或OpenJDK 8。

PyCharm入门程序pycharm.sh尝试查找Java:

# ---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
# Try (in order): PYCHARM_JDK, ../jre, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------
if [ -n "$PYCHARM_JDK" -a -x "$PYCHARM_JDK/bin/java" ]; then
  JDK="$PYCHARM_JDK"
elif [ -x "$IDE_HOME/jre/bin/java" ] && "$IDE_HOME/jre/bin/java" -version > /dev/null 2>&1 ; then
  JDK="$IDE_HOME/jre"
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" -o "$OS_TYPE" = "MidnightBSD" ]; 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" -a -x "$XARGS" -a -x "$DIRNAME" ]; 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"`
          if [ ! -d "$JAVA_LOCATION/bin" ]; then
            JAVA_LOCATION="$JAVA_LOCATION/jre"
          fi
          ;;
        *)
          JAVA_LOCATION=`echo "$JAVA_LOCATION" | "$XARGS" "$DIRNAME" | "$XARGS" "$DIRNAME"`
          ;;
      esac
      if [ -x "$JAVA_LOCATION/bin/java" ]; then
        JDK="$JAVA_LOCATION"
      fi
    fi
  fi
fi
  1. $PYCHARM_JDK
  2. $IDE_HOME/jre/bin/java
  3. $JDK_HOME
  4. $JAVA_HOME

确保您正在使用要使用的Java版本。


1

查看bin您提取的pycharm文件夹的文件夹内部。

有名为pycharm64.vmoptions和的文件pycharm.vmoptions。在其中,您可以使用罪魁祸首选项删除行MaxPermSize=350m

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.