关于pycharm:PyCharm在Linux安装出现报错Java-Runtime-class-file-version-550

15次阅读

共计 3831 个字符,预计需要花费 10 分钟才能阅读完成。

    在 Linux 桌面下装置 PyCharm 的时候呈现如下报错

root@ubuntu:~# cd pycharm-community-2021.1.1
root@ubuntu:~/pycharm-community-2021.1.1# ls
bin               classpath.txt  Install-Linux-tar.txt  license
brokenPlugins.db  help           jbr                    plugins
build.txt         icons.db       lib                    product-info.json
root@ubuntu:~/pycharm-community-2021.1.1# cd bin/
root@ubuntu:~/pycharm-community-2021.1.1/bin# ls
format.sh        inspect.sh   printenv.py          pycharm.svg
fsnotifier       libdbm64.so  pycharm64.vmoptions  pycharm.vmoptions
fsnotifier64     log.xml      pycharm.png          restart.py
idea.properties  ltedit.sh    pycharm.sh
root@ubuntu:~/pycharm-community-2021.1.1/bin# ./pycharm.sh 
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/intellij/idea/Main has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
  at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
  at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
root@ubuntu:~/pycharm-community-2021.1.1/bin#

此问题为 Java 版本太低,须要应用新的 jdk 版本

49 = Java 5
50 = Java 6
51 = Java 7
52 = Java 8
53 = Java 9
54 = Java 10
55 = Java 11
56 = Java 12
57 = Java 13
58 = Java 14
59 = Java 15
60 = Java 16

装置 Java

root@ubuntu:~# tar xvf jdk-16.0.1_linux-aarch64_bin.tar.gz 
root@ubuntu:~# mv jdk-16.0.1 /usr/local/
root@ubuntu:~# cd /usr/local/
root@ubuntu:/usr/local# ls
Ascend  dcmi  games    jdk-16.0.1    lib  python3.7.5  share
bin     etc   include  jdk1.8.0_291  man  sbin         src
root@ubuntu:/usr/local# vim /etc/profile
root@ubuntu:/usr/local# source /etc/profile

环境变量配置文件

root@ubuntu:/usr/local# cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if ["${PS1-}" ]; then
  if ["${BASH-}" ] && ["$BASH" != "/bin/sh"]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$'
    if [-f /etc/bash.bashrc]; then
      . /etc/bash.bashrc
    fi
  else
    if ["`id -u`" -eq 0]; then
      PS1='#'
    else
      PS1='$'
    fi
  fi
fi

if [-d /etc/profile.d]; then
  for i in /etc/profile.d/*.sh; do
    if [-r $i]; then
      . $i
    fi
  done
  unset i
fi


#用于设置 python3.7.5 库文件门路
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH
#如果用户环境存在多个 python3 版本,则指定应用 python3.7.5 版本
export PATH=/usr/local/python3.7.5/bin:$PATH

# control log level. 0-DEBUG, 1-INFO, 2-WARNING, 3-ERROR, default level is WARNING.
export GLOG_v=2

# Conda environmental options
LOCAL_ASCEND=/usr/local/Ascend # the root directory of run package

# lib libraries that the run package depends on
export LD_LIBRARY_PATH=${LOCAL_ASCEND}/add-ons/:${LOCAL_ASCEND}/ascend-toolkit/latest/fwkacllib/lib64:${LOCAL_ASCEND}/driver/lib64:${LOCAL_ASCEND}/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling:${LD_LIBRARY_PATH}

# Environment variables that must be configured
export TBE_IMPL_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe            # TBE operator implementation tool path
export ASCEND_OPP_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/opp                                       # OPP path
export PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin/:${PATH}                 # TBE operator compilation tool path
export PYTHONPATH=${TBE_IMPL_PATH}:${PYTHONPATH}                                                # Python library that TBE implementation depends on

export JAVA_HOME=/usr/local/jdk-16.0.1
export JRE_HOME=/usr/local/jdk-16.0.1/jre/
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
root@ubuntu:/usr/local#

正文完
 0