Cannot find “valid home for jdk” in intellij idea
I'm trying to setup an SDK for intellij idea and I can't find the home for jdk as the error put it.
In the terminal this is what I get
$ java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
I tried to run
$ whereis java
and none of the paths are valid
then I found the jvm folder in usr/lib/jvm none of those worked either.
this is the output of
$ ls -lh /usr/lib/jvm/

I just ran another command
$ update-alternatives --list java
Output was
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
In idea, the sdk selector will only go upto the /bin but the internal files don't appear and in the file explorer I can see the java file but clicking it does nothing nor can I directly copy it's path as I get the error:
"Specified path cannot be found"
Also ran
$ sudo update-alternatives --display java
Output
java - auto mode
link best version is /usr/lib/jvm/java-9-openjdk-amd64/bin/java
link currently points to /usr/lib/jvm/java-9-openjdk-amd64/bin/java
link java is /usr/bin/java
slave java.1.gz is /usr/share/man/man1/java.1.gz
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081
slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
/usr/lib/jvm/java-9-openjdk-amd64/bin/java - priority 1091
slave java.1.gz: /usr/lib/jvm/java-9-openjdk-amd64/man/man1/java.1.gz
java jdk openjdk sdk
add a comment |
I'm trying to setup an SDK for intellij idea and I can't find the home for jdk as the error put it.
In the terminal this is what I get
$ java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
I tried to run
$ whereis java
and none of the paths are valid
then I found the jvm folder in usr/lib/jvm none of those worked either.
this is the output of
$ ls -lh /usr/lib/jvm/

I just ran another command
$ update-alternatives --list java
Output was
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
In idea, the sdk selector will only go upto the /bin but the internal files don't appear and in the file explorer I can see the java file but clicking it does nothing nor can I directly copy it's path as I get the error:
"Specified path cannot be found"
Also ran
$ sudo update-alternatives --display java
Output
java - auto mode
link best version is /usr/lib/jvm/java-9-openjdk-amd64/bin/java
link currently points to /usr/lib/jvm/java-9-openjdk-amd64/bin/java
link java is /usr/bin/java
slave java.1.gz is /usr/share/man/man1/java.1.gz
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081
slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
/usr/lib/jvm/java-9-openjdk-amd64/bin/java - priority 1091
slave java.1.gz: /usr/lib/jvm/java-9-openjdk-amd64/man/man1/java.1.gz
java jdk openjdk sdk
Please run thissudo update-alternatives --display javafrom your terminal and post the results lets see where your java is!
– George Udosen
Oct 4 '17 at 21:20
Updated with the command you asked for and another one that I found .
– Arpit Bharti
Oct 4 '17 at 21:34
add a comment |
I'm trying to setup an SDK for intellij idea and I can't find the home for jdk as the error put it.
In the terminal this is what I get
$ java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
I tried to run
$ whereis java
and none of the paths are valid
then I found the jvm folder in usr/lib/jvm none of those worked either.
this is the output of
$ ls -lh /usr/lib/jvm/

I just ran another command
$ update-alternatives --list java
Output was
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
In idea, the sdk selector will only go upto the /bin but the internal files don't appear and in the file explorer I can see the java file but clicking it does nothing nor can I directly copy it's path as I get the error:
"Specified path cannot be found"
Also ran
$ sudo update-alternatives --display java
Output
java - auto mode
link best version is /usr/lib/jvm/java-9-openjdk-amd64/bin/java
link currently points to /usr/lib/jvm/java-9-openjdk-amd64/bin/java
link java is /usr/bin/java
slave java.1.gz is /usr/share/man/man1/java.1.gz
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081
slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
/usr/lib/jvm/java-9-openjdk-amd64/bin/java - priority 1091
slave java.1.gz: /usr/lib/jvm/java-9-openjdk-amd64/man/man1/java.1.gz
java jdk openjdk sdk
I'm trying to setup an SDK for intellij idea and I can't find the home for jdk as the error put it.
In the terminal this is what I get
$ java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
I tried to run
$ whereis java
and none of the paths are valid
then I found the jvm folder in usr/lib/jvm none of those worked either.
this is the output of
$ ls -lh /usr/lib/jvm/

I just ran another command
$ update-alternatives --list java
Output was
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-9-openjdk-amd64/bin/java
In idea, the sdk selector will only go upto the /bin but the internal files don't appear and in the file explorer I can see the java file but clicking it does nothing nor can I directly copy it's path as I get the error:
"Specified path cannot be found"
Also ran
$ sudo update-alternatives --display java
Output
java - auto mode
link best version is /usr/lib/jvm/java-9-openjdk-amd64/bin/java
link currently points to /usr/lib/jvm/java-9-openjdk-amd64/bin/java
link java is /usr/bin/java
slave java.1.gz is /usr/share/man/man1/java.1.gz
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081
slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
/usr/lib/jvm/java-9-openjdk-amd64/bin/java - priority 1091
slave java.1.gz: /usr/lib/jvm/java-9-openjdk-amd64/man/man1/java.1.gz
java jdk openjdk sdk
java jdk openjdk sdk
edited Oct 4 '17 at 21:30
Arpit Bharti
asked Oct 4 '17 at 21:09
Arpit BhartiArpit Bharti
3619
3619
Please run thissudo update-alternatives --display javafrom your terminal and post the results lets see where your java is!
– George Udosen
Oct 4 '17 at 21:20
Updated with the command you asked for and another one that I found .
– Arpit Bharti
Oct 4 '17 at 21:34
add a comment |
Please run thissudo update-alternatives --display javafrom your terminal and post the results lets see where your java is!
– George Udosen
Oct 4 '17 at 21:20
Updated with the command you asked for and another one that I found .
– Arpit Bharti
Oct 4 '17 at 21:34
Please run this
sudo update-alternatives --display java from your terminal and post the results lets see where your java is!– George Udosen
Oct 4 '17 at 21:20
Please run this
sudo update-alternatives --display java from your terminal and post the results lets see where your java is!– George Udosen
Oct 4 '17 at 21:20
Updated with the command you asked for and another one that I found .
– Arpit Bharti
Oct 4 '17 at 21:34
Updated with the command you asked for and another one that I found .
– Arpit Bharti
Oct 4 '17 at 21:34
add a comment |
1 Answer
1
active
oldest
votes
You will need to add JAVA_HOME to your .bashrc file.
Edit the:
gedit ~/.bashrc
Add the following lines:
## JAVA_HOME
export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin
Add it to the
/etc/environemntfile with:
echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment
Close and open a new terminal.
If all doesn't work then:
Launch Intellij
Press: ctrl+alt+shift+S
- The go to
Platform Settings -> SDKs
- click to add the path for your
java sdk

- The go to
Now your IntelliJ should be able to see it.
1
this doesn't work
– Arpit Bharti
Oct 5 '17 at 5:17
Updated answer please see the update
– George Udosen
Oct 5 '17 at 5:26
I've been in the configure SDK panel from the start, trying to locate the JDK directory. I still get the same error.
– Arpit Bharti
Oct 5 '17 at 6:06
I just purged all traces of java in my system and did a clean install of openjdk-8 and got it to work currently the path is /usr/lib/jvm/java-1.8.0-openjdk-amd64
– Arpit Bharti
Oct 5 '17 at 6:30
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f962066%2fcannot-find-valid-home-for-jdk-in-intellij-idea%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You will need to add JAVA_HOME to your .bashrc file.
Edit the:
gedit ~/.bashrc
Add the following lines:
## JAVA_HOME
export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin
Add it to the
/etc/environemntfile with:
echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment
Close and open a new terminal.
If all doesn't work then:
Launch Intellij
Press: ctrl+alt+shift+S
- The go to
Platform Settings -> SDKs
- click to add the path for your
java sdk

- The go to
Now your IntelliJ should be able to see it.
1
this doesn't work
– Arpit Bharti
Oct 5 '17 at 5:17
Updated answer please see the update
– George Udosen
Oct 5 '17 at 5:26
I've been in the configure SDK panel from the start, trying to locate the JDK directory. I still get the same error.
– Arpit Bharti
Oct 5 '17 at 6:06
I just purged all traces of java in my system and did a clean install of openjdk-8 and got it to work currently the path is /usr/lib/jvm/java-1.8.0-openjdk-amd64
– Arpit Bharti
Oct 5 '17 at 6:30
add a comment |
You will need to add JAVA_HOME to your .bashrc file.
Edit the:
gedit ~/.bashrc
Add the following lines:
## JAVA_HOME
export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin
Add it to the
/etc/environemntfile with:
echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment
Close and open a new terminal.
If all doesn't work then:
Launch Intellij
Press: ctrl+alt+shift+S
- The go to
Platform Settings -> SDKs
- click to add the path for your
java sdk

- The go to
Now your IntelliJ should be able to see it.
1
this doesn't work
– Arpit Bharti
Oct 5 '17 at 5:17
Updated answer please see the update
– George Udosen
Oct 5 '17 at 5:26
I've been in the configure SDK panel from the start, trying to locate the JDK directory. I still get the same error.
– Arpit Bharti
Oct 5 '17 at 6:06
I just purged all traces of java in my system and did a clean install of openjdk-8 and got it to work currently the path is /usr/lib/jvm/java-1.8.0-openjdk-amd64
– Arpit Bharti
Oct 5 '17 at 6:30
add a comment |
You will need to add JAVA_HOME to your .bashrc file.
Edit the:
gedit ~/.bashrc
Add the following lines:
## JAVA_HOME
export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin
Add it to the
/etc/environemntfile with:
echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment
Close and open a new terminal.
If all doesn't work then:
Launch Intellij
Press: ctrl+alt+shift+S
- The go to
Platform Settings -> SDKs
- click to add the path for your
java sdk

- The go to
Now your IntelliJ should be able to see it.
You will need to add JAVA_HOME to your .bashrc file.
Edit the:
gedit ~/.bashrc
Add the following lines:
## JAVA_HOME
export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin
Add it to the
/etc/environemntfile with:
echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment
Close and open a new terminal.
If all doesn't work then:
Launch Intellij
Press: ctrl+alt+shift+S
- The go to
Platform Settings -> SDKs
- click to add the path for your
java sdk

- The go to
Now your IntelliJ should be able to see it.
edited Oct 5 '17 at 5:52
answered Oct 4 '17 at 21:53
George UdosenGeorge Udosen
20.6k94568
20.6k94568
1
this doesn't work
– Arpit Bharti
Oct 5 '17 at 5:17
Updated answer please see the update
– George Udosen
Oct 5 '17 at 5:26
I've been in the configure SDK panel from the start, trying to locate the JDK directory. I still get the same error.
– Arpit Bharti
Oct 5 '17 at 6:06
I just purged all traces of java in my system and did a clean install of openjdk-8 and got it to work currently the path is /usr/lib/jvm/java-1.8.0-openjdk-amd64
– Arpit Bharti
Oct 5 '17 at 6:30
add a comment |
1
this doesn't work
– Arpit Bharti
Oct 5 '17 at 5:17
Updated answer please see the update
– George Udosen
Oct 5 '17 at 5:26
I've been in the configure SDK panel from the start, trying to locate the JDK directory. I still get the same error.
– Arpit Bharti
Oct 5 '17 at 6:06
I just purged all traces of java in my system and did a clean install of openjdk-8 and got it to work currently the path is /usr/lib/jvm/java-1.8.0-openjdk-amd64
– Arpit Bharti
Oct 5 '17 at 6:30
1
1
this doesn't work
– Arpit Bharti
Oct 5 '17 at 5:17
this doesn't work
– Arpit Bharti
Oct 5 '17 at 5:17
Updated answer please see the update
– George Udosen
Oct 5 '17 at 5:26
Updated answer please see the update
– George Udosen
Oct 5 '17 at 5:26
I've been in the configure SDK panel from the start, trying to locate the JDK directory. I still get the same error.
– Arpit Bharti
Oct 5 '17 at 6:06
I've been in the configure SDK panel from the start, trying to locate the JDK directory. I still get the same error.
– Arpit Bharti
Oct 5 '17 at 6:06
I just purged all traces of java in my system and did a clean install of openjdk-8 and got it to work currently the path is /usr/lib/jvm/java-1.8.0-openjdk-amd64
– Arpit Bharti
Oct 5 '17 at 6:30
I just purged all traces of java in my system and did a clean install of openjdk-8 and got it to work currently the path is /usr/lib/jvm/java-1.8.0-openjdk-amd64
– Arpit Bharti
Oct 5 '17 at 6:30
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f962066%2fcannot-find-valid-home-for-jdk-in-intellij-idea%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please run this
sudo update-alternatives --display javafrom your terminal and post the results lets see where your java is!– George Udosen
Oct 4 '17 at 21:20
Updated with the command you asked for and another one that I found .
– Arpit Bharti
Oct 4 '17 at 21:34