Using Java in Command Line When Android Studio is Already Installed


java android

if you have android studio already installed in Your Windows Machine, you can use java and javac (for compiling and running java) without installing anything else (like JDK Environment).

here are the steps:

  • open Computer Properties

  • click Advanced Settings

  • click Environment Variables

  • Select Path and Click Edit

  • click new and paste C:\Program Files\Android\Android Studio\jre\bin and click Ok.

now open powershell / command prompt

enter java -version

now you can compile

javac <file_name>.java

and can run

java <file_name>