Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Local Development Environments How it Works Installation

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


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
220,634 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".