Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSean Flanagan
33,235 PointsDirectory
Hi. I tried moving my version of JDK into the directory but nothing came up. What should I do please?
Thanks.
18 Answers
Craig Dennis
Treehouse TeacherIf you try to choose this when you add a new JDK in IntelliJ
C:\ProgramData\Oracle\Java\javapath\
Does it work?
Craig Dennis
Treehouse TeacherHi Sean!
Do you mean you installed the Java JDK and it's not in the drop box when you go to choose the JDK during new project creation?
What OS are you running?
We'll get it sorted!
Alex Stephens
13,342 PointsThe system variables you need to create a new system variable so you click new and you call this variable JAVA_HOME and the VALUE that the variable needs is where your java jdk is for example my java jdk is in C:\Program Files\Java\jdk1.8.0_51 so then make sure you find your path to the jdk and put that in as the value for the system variable if that does not work just add this to the end of the \bin so it looks like this C:\Program Files\Java\jdk1.8.0_51\bin and then save it and that should work :).
Sean Flanagan
33,235 Points"The system variables you need to create a new system variable so you click new..." Which menu do I have to select New from?
By the way, I've moved my JDK to my desktop.
Alex Stephens
13,342 Pointsyou click new in system variables and a window will open up and in the box variable name put JAVA_HOME and for the variable value add your path to the jdk example C:\Users\Alex Stephens\Desktop\jdk1.8.0_51\bin
Craig Dennis
Treehouse TeacherSean,
Are you opening a command prompt when you type java -version? Try typing cmd
in the run bar to open a command prompt open.
Let me know what that prompt says.
Craig Dennis
Treehouse TeacherCan you see if this works:
where javac
Sean Flanagan
33,235 PointsHi Craig. My OS is Windows 7. My JDK version is 14.1.4. I've got as far as the "Select Home Directory for JDK" dialogue box. This is where I've hit a snag. I'm not sure which directory is the best one to use.
I'd appreciate any advice you have to offer.
Sean :-)
Craig Dennis
Treehouse TeacherHmmm 14.1 is your version of IntelliJ. Did you do the step where you download and install the Java JDK?
What is your result when you run
java -version
Sean Flanagan
33,235 Points"Did you do the step where you download and install the Java JDK?" Yes, it's jdk-8u60-windows-i586.
When I run java -version, I just get a Command Prompt. It pops up for less than a second and then vanishes.
Alex Stephens
13,342 PointsHave you tyred setting the system variables in your computer that is pointed to the jdk ?
Sean Flanagan
33,235 PointsAlex Stephens: Hi Alex. Thanks for chiming in. What should the system variables be set to please?
Thanks. :-)
Sean Flanagan
33,235 PointsOkay, from my desktop, I clicked on the Start menu -> Computer -> System Properties -> Advanced System Settings -> Environment Variables -> New (under System Variables). At this point, the New System Variable box pops up. So in "Variable name" I type in JAVA_HOME and in "Variable value", my path?
Craig Dennis
Treehouse TeacherIf its not there already I'd suggest reinstalling your Java JDK
Sean Flanagan
33,235 PointsIt just says "The selected directory is not a valid home for the JDK".
Sean Flanagan
33,235 PointsHi Craig. Thanks for your suggestion. Sorry for the delay - this is due to my getting ready to go on holiday (or vacation as you guys Across the Pond call it :-) ) tomorrow.
To answer your question, I called up the Command Prompt. It says:
"C:\Users\user>" and there's a cursor after it where you can type. Do I need to type anything?
Thanks Craig :-)
Craig Dennis
Treehouse TeacherGreat! Now run
java -version
Sean Flanagan
33,235 PointsDone. Output:
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode, sharing)
Thanks for your help so far. :-)
Sean Flanagan
33,235 PointsINFO: Could not find files for the given pattern(s).
Craig Dennis
Treehouse TeacherOkay... then
where java
Sean Flanagan
33,235 PointsC:\ProgramData\Oracle\Java\javapath\java.exe
Sean Flanagan
33,235 PointsHi Craig. Thank you and Alex for your help. I got a reply from you but it seems to have disappeared. I opened IntelliJ but it took me to this page with a title bar and menu bar. On the left is a window with Project and a down arrow and beneath that is something called External Libraries. My command prompt is still open. Do I need to type in:
C:\ProgramData\Oracle\Java\javapath\java
?
Thanks.
Craig Dennis
Treehouse TeacherI believe you are all set to go now!
Craig Dennis
Treehouse TeacherI believe you are all set to go now!
Sean Flanagan
33,235 PointsHi Craig. Thanks for your help. Unfortunately it's still not working. I've got the dialogue box "Select Home Directory for JDK" open but none of the folders will accommodate JDK. Every time I click the blue OK button at the bottom of the dialogue box, I just get a message: "The selected directory is not a valid home for JDK".
Craig Dennis
Treehouse TeacherSean,
Does this folder exist? C:\Program Files\Java\
The jdk should be in that directory. Choose the JDK folder and choose okay.
Craig Dennis
Treehouse TeacherSean,
Does this folder exist? C:\Program Files\Java\
The jdk should be in that directory. Choose the JDK folder and choose okay.
Sean Flanagan
33,235 PointsYes, the folder you refer to exists. I clicked on it and it's let me in. Thank you very much for your help Craig. I very much appreciate what you and Alex have done for me and sorry for all the trouble. :-)
Craig Dennis
Treehouse TeacherCraig Dennis
Treehouse TeacherCheck out this post.