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 trial

Java Local Development Environments How it Works Installation

Installed JDK, but terminal still doesn't recognize java -version?

Hello,

After following the video and downloading the JDK, everything went successfully except for when I attempted to verify the installation by typing java -version into the terminal. The terminal still didn't recognize the command, and outputted: "-bash: java: command not found." Any help would be much appreciated. Thanks.

1 Answer

Steven Parker
Steven Parker
231,269 Points

It sounds like the PATH environment variable does not include the location of the java runtime. If you're still in the same terminal window as you used for the install, try opening a new one and see if it works there. If it does, just close the old terminal.

If it still doesn't, then the install didn't update the run command file to extend the PATH, possibly because the installation didn't have the proper privileges. In that case you might try reinstalling as "root".