How can Eclipse find JDK in Linux?
Asked Answered
M

6

13

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

Morganica answered 30/5, 2013 at 19:6 Comment(5)
Just add it to that directory...Rupert
thanks, but add what to which directory?Morganica
/home/$USER/development/eclipse/jre/bin/javaTimberhead
you mean add my jdk folder to /home/$USER/development/eclipse/jre/bin/java directory?Morganica
Eclipse-> Windows-> Java -> Installed JRE -> Search buttonMatzo
C
25

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]
Crellen answered 30/5, 2013 at 19:24 Comment(2)
Thank you for your answer. It works. I thought I could resolve this just setting the environment variables, I don't like to edit this kind of file, an application script, but util now your suggestion it was the only one that works.Morganica
Thanks for adding the all important instruction "to the begining of your eclipse.ini file:"Urbannai
E
4

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/
Eun answered 4/12, 2013 at 19:25 Comment(0)
B
1

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

Betseybetsy answered 20/1, 2017 at 21:11 Comment(0)
I
0

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

Iorgos answered 12/9, 2018 at 5:52 Comment(0)
S
0

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

Spinnaker answered 31/1, 2020 at 5:58 Comment(0)
T
0

-startup ... openFile

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

-vmargs ...

Telmatelo answered 9/6, 2020 at 5:0 Comment(1)
This lacks an explanation how this works and why it is supposed to help. It also is weirdly similar to existing answers. In order to avoid the (probably undeserved) impression that you are just trying to get reputation by copying upvoted answers it is hence necessary to explain how the minor visible differences achieve a noticably different or better result. Additional details do not improve usefulness of the answer if the difference they make is not explained.Inaugural

© 2022 - 2024 — McMap. All rights reserved.