# How To Use The Bundled JDK in Android Studio To Run Gradle Command In Terminal
[SOURCE](https://stackoverflow.com/a/43237101)
Because Android Studio (AS) comes with [a built in JDK](https://stackoverflow.com/a/46608636), we can try to use that as our JRE (no need to download external JRE) to run Gradle command.
1. Go to your home directory (user’s home):
```
cd ~
or
cd /Users/viet/
```
2. Create a `.bash_profile` file. In short, this file is loaded before Terminal loads your shell environment and contains all the startup configuration and preferences for your command line interface. For more information, see [here](https://natelandau.com/my-mac-osx-bash_profile/) and [here](https://coolestguidesontheplanet.com/add-shell-path-osx/).
3. Type `nano .bash_profile` – This command will open the `.bash_profile `document (or create it if it doesn’t already exist).
4. Paste in the path to the AS’s JDK. You can find out the path by going to `Application` and `right click Android Studio.app -> Show Package Contents`:
```
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/
```
5. Now save your changes by typing `ctrl + O` -> Hit return to save. Then exit Nano by typing `ctrl + X`.
6. Now we need to *activate* your changes. Type `source .bash_profile` and watch your prompt change.
7. Might need to restart the computer for the Gradle command to take effect.