Question: I have a small problem with Eclipse on my Ubuntu machine. I installed JDK, set JAVA\_HOME and PATH variables, all seems correct, but eclipse refuses to launch and throws an error:

> 
> 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: /opt/eclipse/jre/bin/java
>  java in your current PATH
> 
> 
> 

have no clue what's the problem. help please.

note:

I am able to run java and javac in terminal.

Answer: 
You need to create a link at /usr/bin/java for the java binary (wherever you have placed it).

```
sudo ln -s /path/to/jre*/bin/java /usr/bin/java
```
This is the problem of your jdk is not setup properly for current profile.
Before starting eclipse in your current profile. Run "java -version" command on your current profile where you are running eclipse. Surely it will ask to install jdk/jre even jdk already installed but on different profile.

Hence there is two way:
Solution 1. install jdk on current profile edit and add following lines 
vi /etc/profile 
export JAVA\_HOME=/usr/local/jdk-1.8
export PATH=$PATH:$JAVA\_HOME/bin

Solution 2: ~/.profiles
export JAVA\_HOME=/usr/local/jdk-1.8
export PATH=$PATH:$JAVA\_HOME/bin

Solution 3: I tried and working perfectly for me.
 1. gedit /home/../eclipse/eclipse.ini
 2. Add following line before -vmargs and any plugin or jar execution in eclipse.ini file

```
-startup
-vm        
/usr/local/java/jdk1.8.0_251/bin/java.exe
plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.1100.v20190907-0426
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM

```

This solution is perfectly working after explore from many stackoverflow suggestions and blogs.