Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse can't find jdk installed with sdkman

Im new with sdkman, but I managed to install it and install some software with it: JDK, Gradle and a few others. The problem is that after I downloaded Eclipse and tried to run it, it just simply can't find the JDK. I have already exported JAVA_HOME, and PATH. In fact, I can actually run java, javac and other Java commands from the terminal, I even tried with update-alternatives. I have changed the ownership of the eclipse folder with no results, Eclipse cannot find the JDK.

I had to install java with apt-get and that makes eclipse work, but whats the of using sdkman? So my question is: What configuration am I missing to make Eclipse use the sdkman java installation.

like image 931
Raziel25 Avatar asked Jan 14 '18 09:01

Raziel25


People also ask

Where is Sdkman Java installed?

The installed SDKs are stored in the SDKMAN! directory which defaults to ~/. sdkman/candidates. Therefore, the currently selected version of Java will also be available as current in that directory.

How do I use Sdkman on Windows?

Windows Installation Several options exist for installing SDKMAN! on Windows today. The first solution involves installing Windows Subsystem for Linux (WSL) prior to attempting SDKMAN installation. You need a basic toolchain including bash, zip, unzip, and curl (tar and gzip required for special cases).

What is Sdkman Mac?

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates.


2 Answers

I faced the same issue and resolved it by creating a symbolic link in /usr/bin for both java and javac.

sudo ln -s ~/.sdkman/candidates/java/current/bin/javac /usr/bin/javac
sudo ln -s ~/.sdkman/candidates/java/current/bin/java /usr/bin/java

I got these locations by doing

which javac
which java
like image 187
cmxiv 914 Avatar answered Oct 06 '22 04:10

cmxiv 914


Locate and edit your eclipse.ini file and change the line right after "-vm" to this:

/home/YOURUSER/.sdkman/candidates/java/current/bin

That should do it for Linux systems. I'm not sure about Windows or Mac tho.

like image 38
user352472 Avatar answered Oct 06 '22 03:10

user352472