Cannot find “valid home for jdk” in intellij idea












2















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/



enter image description here



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









share|improve this question

























  • 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
















2















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/



enter image description here



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









share|improve this question

























  • 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














2












2








2








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/



enter image description here



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









share|improve this question
















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/



enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 4 '17 at 21:30







Arpit Bharti

















asked Oct 4 '17 at 21:09









Arpit BhartiArpit Bharti

3619




3619













  • 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



















  • 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

















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










1 Answer
1






active

oldest

votes


















0














You will need to add JAVA_HOME to your .bashrc file.





  1. Edit the:



    gedit ~/.bashrc



  2. Add the following lines:



    ## JAVA_HOME
    export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
    export PATH=$PATH:$JAVA_HOME/bin



  3. Add it to the /etc/environemnt file with:



    echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment


  4. Close and open a new terminal.



  5. If all doesn't work then:




    1. Launch Intellij



    2. Press: ctrl+alt+shift+S




      • The go to Platform Settings -> SDKs

      • click to add the path for your java sdk


      enter image description here






Now your IntelliJ should be able to see it.






share|improve this answer





















  • 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













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
});


}
});














draft saved

draft discarded


















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









0














You will need to add JAVA_HOME to your .bashrc file.





  1. Edit the:



    gedit ~/.bashrc



  2. Add the following lines:



    ## JAVA_HOME
    export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
    export PATH=$PATH:$JAVA_HOME/bin



  3. Add it to the /etc/environemnt file with:



    echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment


  4. Close and open a new terminal.



  5. If all doesn't work then:




    1. Launch Intellij



    2. Press: ctrl+alt+shift+S




      • The go to Platform Settings -> SDKs

      • click to add the path for your java sdk


      enter image description here






Now your IntelliJ should be able to see it.






share|improve this answer





















  • 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


















0














You will need to add JAVA_HOME to your .bashrc file.





  1. Edit the:



    gedit ~/.bashrc



  2. Add the following lines:



    ## JAVA_HOME
    export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
    export PATH=$PATH:$JAVA_HOME/bin



  3. Add it to the /etc/environemnt file with:



    echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment


  4. Close and open a new terminal.



  5. If all doesn't work then:




    1. Launch Intellij



    2. Press: ctrl+alt+shift+S




      • The go to Platform Settings -> SDKs

      • click to add the path for your java sdk


      enter image description here






Now your IntelliJ should be able to see it.






share|improve this answer





















  • 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
















0












0








0







You will need to add JAVA_HOME to your .bashrc file.





  1. Edit the:



    gedit ~/.bashrc



  2. Add the following lines:



    ## JAVA_HOME
    export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
    export PATH=$PATH:$JAVA_HOME/bin



  3. Add it to the /etc/environemnt file with:



    echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment


  4. Close and open a new terminal.



  5. If all doesn't work then:




    1. Launch Intellij



    2. Press: ctrl+alt+shift+S




      • The go to Platform Settings -> SDKs

      • click to add the path for your java sdk


      enter image description here






Now your IntelliJ should be able to see it.






share|improve this answer















You will need to add JAVA_HOME to your .bashrc file.





  1. Edit the:



    gedit ~/.bashrc



  2. Add the following lines:



    ## JAVA_HOME
    export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"
    export PATH=$PATH:$JAVA_HOME/bin



  3. Add it to the /etc/environemnt file with:



    echo "JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64"" | sudo tee -a /etc/environment


  4. Close and open a new terminal.



  5. If all doesn't work then:




    1. Launch Intellij



    2. Press: ctrl+alt+shift+S




      • The go to Platform Settings -> SDKs

      • click to add the path for your java sdk


      enter image description here






Now your IntelliJ should be able to see it.







share|improve this answer














share|improve this answer



share|improve this answer








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
















  • 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




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Mouse cursor on multiple screens with different PPI

Agildo Ribeiro

Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”