• Post Reply Bookmark Topic Watch Topic
  • New Topic

Having trouble setting up Java JDK

 
Sophi Rose
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently got my book Head First Java, which tells me I need to set up JDK in order to do code at the command line. But the book doesn't go about how to do that in well enough detail. I found the set up guide here Guidebut I am still having trouble. I feel like I set everything up correctly but there is still something off. I set the path as it described and I tried to do a version test to see if it was set up correctly, but it just says "javac is not recognized...." I don't know if I am trying to check the version in the wrong place, or if I am using cmd wrong (I never did programs in cmd I always used BlueJ in class). I attached pictures to show what I've been trying to do. If you have any suggestions / help I would greatly appreciate it. Thank you.
EnviroVar.png
[Thumbnail for EnviroVar.png]
Environment Variables
Javajdk.png
[Thumbnail for Javajdk.png]
File location
cmdscreen.png
[Thumbnail for cmdscreen.png]
cmd Screen
 
Carey Brown
Saloon Keeper
Posts: 2329
31
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you install the JDK or the JRE? For the "javac.exe" file, it has to be the JDK.

This should be available in a directory like (current version of Java)
C:\Program Files\Java\jdk1.8.0_92\bin

If you already had a command line window open before you changed JAVA_HOME and PATH then you'll need to close the window and open a new one.
 
Liutauras Vilda
Marshal
Posts: 3401
131
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A warm welcome to the Ranch

1. Please close commander and open it again
2. Type echo %PATH%
3. Post here what you got as an output
 
Ron McLeod
Saloon Keeper
Posts: 1287
149
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sophi Rose wrote:

Does your platform really have JDK version 1.5 installed or is that from an example in an old book/webpage?  That version came-out 10+ years ago.
 
Ron McLeod
Saloon Keeper
Posts: 1287
149
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ignore my question - it looks like it really is version 1.5

 
Sophi Rose
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Liutauras Vilda This is the output for the echo.

@Ron McLeod It says it's version 5 (for some reason it reads it at 1.5). Should I not worry about what the book says and just get latest?
cmd2.png
[Thumbnail for cmd2.png]
echo commandp
jdk5.png
[Thumbnail for jdk5.png]
JDK version
 
Sophi Rose
Greenhorn
Posts: 4
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it to work by doing some extra digging. First I updated to the latest version, then I changed the %JAVA_HOME%\bin to the direct path C:\Program Files\Java\jdk1.8.0_91\bin. I ran the javac -version at command and it returned fine.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15758
74
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is backward compatible, so even if you use the latest version (Java 8) then everything in the book will still work if it's using Java 5.

A book about Java 5 is still OK if you want to learn the basics, but a lot of new stuff has been added to Java 6, 7 and 8 so at some point you'll want to learn the new stuff, which will not be in your book about Java 5.

And welcome to the Ranch and have fun learning Java! 
 
Liutauras Vilda
Marshal
Posts: 3401
131
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sophi Rose wrote:I got it to work by doing some extra digging. First I updated to the latest version, then I changed the %JAVA_HOME%\bin to the direct path C:\Program Files\Java\jdk1.8.0_91\bin. I ran the javac -version at command and it returned fine.
And you just got your first cow for a greatly presented question from the beginning and for finding the solution on your own 
 
Campbell Ritchie
Marshal
Posts: 53140
124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch again.

I think there is nothing wrong with using HFJ as long as you remember there have been major upgrades since then. The worst thing you can do wrong with HFJ is to buy a brand‑new copy and pay full price

Beware of the Party application in the early chapters. That is incomplete and will not execute.
 
Sophi Rose
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Campbell Ritchie Thank you for the heads up!

Also, thank you everyone for your help. Time to start learning!
 
Campbell Ritchie
Marshal
Posts: 53140
124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a pleasure

Please always copy'n'paste text from the command line because screenshots can be difficult to read.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!