How can Eclipse find JDK in Linux?

2020-08-19 07:09发布

I've installed Eclipse and jdk manually. My JAVA_HOME is set, and I am able to run the java -version and javac -version commands, but when I try to run Eclipse, it shows the following message:

A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
/home/$USER/development/eclipse/jre/bin/java
java in your current PATH

How can I fix this?

Distro:

Ubuntu 12.0.4 64 bits.

Java:

java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

$JAVA_HOME:

/usr/lib/jvm/jdk1.6.0_45

My $PATH contains the following:

/usr/lib/jvm/jdk1.6.0_45/bin

Thank you for the help

6条回答
够拽才男人
2楼-- · 2020-08-19 07:18

Another possible solution is to add your java bin path to your environment variable PATH in /etc/profile file. Something like this

sudo gedit /etc/profile

Go to the end of the file and add this line:

export PATH=$PATH:/path/to/your/jdk/bin/
查看更多
何必那么认真
3楼-- · 2020-08-19 07:18

Folder Structure after download eclipse

  1. open eclipse.ini add on top

    -vm

[your-$JAVA_HOME-path]

ex: /usr/lib/jvm/jdk1.8.0_241/bin

查看更多
仙女界的扛把子
4楼-- · 2020-08-19 07:19

-startup ... openFile

-vm /usr/java/jdk1.8.0_251/bin/

-vmargs ...

查看更多
叛逆
5楼-- · 2020-08-19 07:35

Go to your jre path within JDK installation home and copy the jre directory under eclipse installation.

查看更多
乱世女痞
6楼-- · 2020-08-19 07:36

If Eclipse isn't finding your JRE/JDK or finding the wrong version, add the following two lines to the begining of your eclipse.ini file:

-vm
[your-path-to-java-executable]
查看更多
我命由我不由天
7楼-- · 2020-08-19 07:40

I had some issues with the other solutions, so the following is what I did:

1) Open a terminal window

2) Enter the eclipse sub-directory cd ~/eclipse

3) Execute: whereis java

4) Pick a jdk path that also has the jre as a sub-directory I chose: /usr/java/jdk1.8.0_102/bin/java which has a jre subdir: /usr/java/jdk1.8.0_102/jre

5) Create a symbolic link in the ~/eclipse sub-directory. The following is an example: ln -s /usr/java/jdk1.8.0_102/jre jre

查看更多
登录 后发表回答