Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Having trouble setting up Java JDK

 
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 10687
85
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 8856
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 4491
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 4491
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8856
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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  
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
No more fooling around. Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic