java Pycharm 安装抱怨 OpenJDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11477719/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pycharm install complains about OpenJDK
提问by webfanks
I try to install Pycharm on Ubuntu 12.04 and I have this information:
我尝试在 Ubuntu 12.04 上安装 Pycharm,我有以下信息:
user@user:~/Pobrane/pycharm-2.5.2/bin$ sh pycharm.sh
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
OpenJDK Server VM (build 20.0-b12, mixed mode)
WARNING: You are launching the IDE using OpenJDK Java runtime.
ITS KNOWN TO HAVE PERFORMANCE AND GRAPHICS ISSUES!
SWITCH TO THE ORACLE(SUN) JDK BEFORE REPORTING PROBLEMS!
NOTE: If you have both Oracle (Sun) JDK and OpenJDK installed
please validate either PYCHARM_JDK, JDK_HOME, or JAVA_HOME environment variable points to valid Oracle (Sun) JDK installation.
See http://ow.ly/6TuKQ for more info on switching default JDK.
Press Enter to continue.
What to do to work normally?
怎么做才能正常上班?
采纳答案by Dirk Eschler
The Oracle (Sun) JDK is no longer included by most newer distributions due to restrictions set by Oracle. Instead they ship with OpenSDK. While OpenSDK works for most applications, PyCharm seems to have some issues with it.
由于 Oracle 设置的限制,大多数较新的发行版不再包含 Oracle (Sun) JDK。相反,它们随 OpenSDK 一起提供。虽然 OpenSDK 适用于大多数应用程序,但 PyCharm 似乎存在一些问题。
You have to install the Oracle (Sun) JDK manually and make sure it's the default JDK or set the appropriate environment variables when launching PyCharm.
您必须手动安装 Oracle (Sun) JDK 并确保它是默认 JDK 或在启动 PyCharm 时设置适当的环境变量。
回答by littlepea
You need to swap OpenJDK to Sun JDK.
您需要将 OpenJDK 交换为 Sun JDK。
Run this in your terminal (Ctrl + Alt + T):
在您的终端中运行它(Ctrl + Alt + T):
sudo apt-get purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Follow the installation instructions and then check your Java version:
按照安装说明进行操作,然后检查您的 Java 版本:
java -version
It should return something like this:
它应该返回如下内容:
java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
To automatically set up the Java 7 environment variables, you can install the following package:
要自动设置 Java 7 环境变量,您可以安装以下软件包:
sudo apt-get install oracle-java7-set-default
Via WebUpd8
通过WebUpd8
You don't even need to re-install pycharm it'll switch to the new Java version automatically.
你甚至不需要重新安装 pycharm 它会自动切换到新的 Java 版本。
Hope it helps.
希望能帮助到你。
回答by Agi Hammerthief
- Check the architecture of your system:
uname -m
- Download Oracle's JDK (7/8) from their websiteor use
wget
:mkdir -p ~/Downloads && cd ~/Downloads && wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31-linux-x64.tar.gz
- Once that's done, extract it to
/opt/jdk
(as root):mkdir -p /opt/jdk && tar -zxf ~username/Downloads/jdk-8u*-linux-x64.tar.gz -C /opt/jdk
- Download Pycharm and follow normal installation procedure.
- Edit
/path/to/pycharm/install/bin/pycharm.sh
. Immediately abovethe conditional block starting withif [ -n "$PYCHARM_JDK" -a -x "$PYCHARM_JDK/bin/java" ];
, add a line statingexport PYCHARM_JDK=/opt/jdk/jdk1.8.0_N;
(whereN
is the version of the JDK that you have downloaded). - Start Pycharm and Go to 'Help' -> 'About'. It should show 'JRE 1.8.0_*' instead of 'OpenJDK'.
- 检查系统架构:
uname -m
- 从他们的网站下载 Oracle 的 JDK (7/8)或使用
wget
:mkdir -p ~/Downloads && cd ~/Downloads && wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31-linux-x64.tar.gz
- 完成后,将其解压缩到
/opt/jdk
(以 root 身份):mkdir -p /opt/jdk && tar -zxf ~username/Downloads/jdk-8u*-linux-x64.tar.gz -C /opt/jdk
- 下载 Pycharm 并按照正常安装程序进行。
- 编辑
/path/to/pycharm/install/bin/pycharm.sh
。在以 开头的条件块的正上方if [ -n "$PYCHARM_JDK" -a -x "$PYCHARM_JDK/bin/java" ];
,添加一行说明export PYCHARM_JDK=/opt/jdk/jdk1.8.0_N;
(N
您下载的 JDK 版本在哪里)。 - 启动 Pycharm 并转到“帮助”->“关于”。它应该显示“JRE 1.8.0_*”而不是“OpenJDK”。
Note:Don't run update-alternatives
if you have installed software that uses OpenJDK. Switching versions might cause issues/crashes in those applications.
注意:update-alternatives
如果您安装了使用 OpenJDK 的软件,请不要运行。切换版本可能会导致这些应用程序出现问题/崩溃。
回答by Sayem
Just to add to littlepea's answer, if you try to uninstall openjdk, then it will uninstall all the applications that depends on this package along with it i.e. XBMC. You can always install two JDK's and let the application choose which JDK it wants to use and vice versa. I have the two JDK's installed and don't have any problem in running either XBMC or PyCharm.
只是为了补充littlepea 的答案,如果您尝试卸载 openjdk,那么它将卸载所有依赖于该软件包的应用程序,即XBMC。您始终可以安装两个 JDK,然后让应用程序选择它想要使用的 JDK,反之亦然。我安装了两个 JDK,在运行 XBMC 或 PyCharm 时没有任何问题。