Eclipse cannot find Java on Ubuntu

Java is correctly installed in my Ubuntu 12.04, and the PATH variable is set in the .bashrc .

The java -version gives the expected result.

But when I try to start Eclipse, it complains that the JDK was not found.

enter image description here

+4
source share
6 answers

It seems to me that you installed the PATH environment in your shell, but you start Eclipse with some menu item or shortcut, and the context uses a different PATH.

One option is to modify the eclipse.ini file, as the other answers say.

Another option is to try to find out why Eclipse is starting with a different PATH in what is in your command path. (A “fix” can simply log out and log back in to start the launcher of the updated PATH parameter. Or the launcher may collect the incorrect PATH setting from another location.)

+3
source

You may need to edit the eclipse.ini file and specify the path there. Read this for more details.

EDIT:

  -vm /opt/sun-jdk-1.6.0.02/bin/java 

This is how your vm argument should be in the .ini file. If not, change it. However, be careful. Normally, Java is installed in / opt, but it checks once on your system.

Also consider this question.

+8
source

Java in Ubuntu is usually located in /usr/lib/jvm/<your_java_version> , but ubuntu usually creates a symlink to the current version of java in /usr/lib/jvm/java-7-sun . A symbolic link may or may not exist depending on how you installed java on your computer, now that it is no longer available in repositories.

Go to /usr/lib/jvm/ and enter the ls to find the appropriate folder where java is located. After you dot the spot, find the file named libjvm.so .

In my machine, -vm arg looks like this:

 -vm /usr/lib/jvm/java-6-sun/jre/lib/amd64/server/libjvm.so 

Make sure the path is on a new line below -vm or it will not work.

+4
source

You can directly tell your eclipse session which jdk / jre you want it to start by adding the following to eclipse.ini :

 -vm home/..../jre/bin/javaw.exe 
0
source

Install eclipse through the package manager and you should not have this problem.

You installed eclipse manually in your home directory and eclipse tries to find the jre where it was installed, but you probably did not download the version of eclipse that comes with its own jdk. As such, this requires a bit more help.

As I said above, uninstall the current installation and install using the package manager.

0
source

Follow below to determine the path variable available for all launchers for the manually installed JDK

Step:

1-

  cd /etc/ 

2-

 sudo vim ~/.profile 

3 Add the codes below to the opened file step2

  PATH="$HOME/bin:$HOME/.local/bin:/usr/lib:$PATH" JAVA_HOME="/usr/lib/jvm/jdk1.7.0_79" export JAVA_HOME PATH=$PATH:$JAVA_HOME/bin export PATH 

4 - Reboot the system

0
source

Source: https://habr.com/ru/post/1414604/


All Articles