Command 'gradle' not found. How can I run the gradle command from any directory?

23,150

Edit ~/.bashrc and add the export ... command there.

Share:
23,150

Related videos on Youtube

Jeeva
Author by

Jeeva

Updated on September 18, 2022

Comments

  • Jeeva
    Jeeva over 1 year

    I am trying to learn gradle build.

    I followed these instructions on gradle.org.

    To verify it i am issuing command.

    gradle -v
    

    I get this output:

    Command 'gradle' not found, but can be installed with:
    
    sudo apt install gradle
    

    But after issuing this command from the installation link

    $ export PATH=$PATH:/opt/gradle/gradle-4.10.2/bin
    

    the above command shows gradle version in my computer.

    But the problem is once I close the terminal and issue the command I get the error command not found, and once again if I issue the export PATH... command, then the gradle command starts working.

    So how do I add this path permanently so I can issue the gradle command from anywhere?

  • Jeeva
    Jeeva over 5 years
    As per your suggestion added this and it started working GRADLE_HOME=/opt/gradle/gradle-4.10.2 PATH=$PATH:$GRADLE_HOME/bin export GRADLE_HOME export PATH