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!

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

Android Build a Simple Android App (2014) Getting Started with Android Setting Up an Android Development Environment for Windows

javac is not recognized and git.exe can't start.

I have already installed java and android studio according to the video. I have 2 issues.

  1. I tried running javac -version in the command prompt, I still get the same message as before installing java " 'javac' is not recognized as an internal or external command, operable program or batch file."

  2. When I open android studio I get a pop up message "Can't start Git: git.exe. Probably the path to Git executable is not valid". Android studio seems to work just fine whenever I follow along the video. Should I fix this problem, and how to do it? Or is it not a necessity?

2 Answers

Courses Plus Student 21,474 Points

Hey Said!

This is a common issue for beginners. Java requires some manual setup on Windows. You'll have to manually assign the PATH Environment variable, so you can use commands such as "javac" from the command prompt.

See this tutorial on how to set the PATH Environment Variable: http://stackoverflow.com/a/10046715

Michael Fraser
Michael Fraser
11,229 Points

It sounds like the first problem is that even though you have installed java, your computer doesn't know where to find the java/javac executables. I recommend reading through this carefully to fix your command prompt issue: https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

For using git in Android studio, you need to have downloaded the git executable. Downloading the github desktop version for windows (assuming windows due to javac error you mentioned) will download git.exe and put it in an obscure folder that you can then point to in android studio. For example, my git.exe was found in: C:\Users\userName\AppData\Local\GitHub\PortableGit_[random letters and numbers]\bin. To point android studio to this folder, go to File -> Settings, open Version Control, click "Git" and click the "..." near the "Path to Git executable" input. Navigate to the git.exe in the folder mentioned previously and Android Studio should no longer give you that error.

If android studio is working then I guess fixing the javac issue is unimportant? The git issue only needs to be fixed if you are going to be using git-related VCS directly from Android Studio.

Hope this helps