简体   繁体   English

Eclipse找不到JRE

[英]Eclipse can't find the JRE

I'm having a problem with the JRE on Ubuntu 14.04. 我在Ubuntu 14.04上遇到JRE问题。

EDIT: the computer has no connection to Internet, so I'm using the apt-offline method (I did that already with the installation of eclipse). 编辑:计算机没有与Internet的连接,所以我正在使用apt-offline方法(我已经在安装eclipse时做到了这一点)。

Im trying to run eclipse cdt, when I play it, I get this message: 我试图运行eclipse cdt,当我播放它时,出现以下消息:

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. Java运行时环境(JRE)或Java开发工具包(JDK)必须可用才能运行Eclipse。 No Java virtual machine was found after searching the following locations: /usr/lib/eclipse/jre/bin/java java in your current PATH 搜索以下位置后未找到Java虚拟机:当前路径中的/ usr / lib / eclipse / jre / bin / java java

the java --version command gave me that output: java --version命令给了我输出:

The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.8-jre-headless
 * openjdk-7-jre-headless
 * gcj-4.6-jre-headless
 * openjdk-6-jre-headless
Try: sudo apt-get install <selected package>

So I understand that the JRE not installed yet, so I installed it: 因此,我知道尚未安装JRE,所以我安装了它:

sudo apt-get install openjdk-7-jre-headless

and that is the output: 这是输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
openjdk-7-jre-headless is already the newest version.
openjdk-7-jre-headless set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

after java --version command, the output is again like the previous output. java --version命令之后,输出再次类似于先前的输出。

I tried to read this and that and some more articles 我想读和一些文章

EDIT 2: I also tried to add the path usr/lib/jvm/java-7-openjdk-amd64 to the etc/profile file: 编辑2:我还试图将路径usr/lib/jvm/java-7-openjdk-amd64etc/profile文件:

JAVA_HOME=/usr/local/java/jre1.8.0_60
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH

I don't understand what I am missing or doing wrong. 我不明白自己在想什么或做错了什么。 Or maybe the JRE is installed but Eclipse doesn't know it somehow? 或者也许已经安装了JRE,但是Eclipse不知道它是什么?

I will be very happy for some guidance. 我会很高兴获得一些指导。

Install via 通过安装

sudo apt-get install openjdk-7-jdk 

You might also add the JDK manually to Eclipse: 您还可以将JDK手动添加到Eclipse:

Windows -> Preferences
=> Java / Installed JREs

If it is not listed, click "Add", choose "Standard VM", and click "Next". 如果未列出,请单击“添加”,选择“标准VM”,然后单击“下一步”。 Set "JRE Home" as something like /usr/lib/jvm/java-7-openjdk-amd64 (navigate via "Directroy" button). 将“ JRE Home”设置为/usr/lib/jvm/java-7-openjdk-amd64 (通过“ Directroy”按钮导航)。

只需从jdk复制“ jre”文件夹并将其设置在“ eclipse”文件夹中即可

尝试在〜/ .bashrc中添加Java路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM