ubuntu下配置java,gradle,groovy环境变量

2018-11-03  本文已影响16人  HWilliamgo

1. 下载

到官网下载各自对应的压缩包并解压。注意,如果提前用AndroidStudio下载了gradle,那么可以直接在~/.gradle/wrapper/dists/下找到已经下载了的gradle。

2.配置

命令行

  1. 用gedit打开profile配置文件
$ sudo gedit /etc/profile
  1. 拉倒最底部,依次根据自己的下载路径加入如下配置
# set java environment
export JAVA_HOME=/home/william/下载/jdk-8u181-linux-x64/jdk1.8.0_181
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

# set gradle environment
export GRADLE_HOME=/home/william/.gradle/wrapper/dists/gradle-4.6-all/bcst21l2brirad8k2ben1letg/gradle-4.6
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${GRADLE_HOME}/bin:${JAVA_HOME}:${PATH}

# set groovy environment
export GROOVY_HOME="/home/william/公共的/apache-groovy-sdk-2.5.3/groovy-2.5.3"
export PATH=$GROOVY_HOME/bin:$PATH
  1. 保存,查验
$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
$ gradle -version

------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------

Build time:   2018-02-28 13:36:36 UTC
Revision:     8fa6ce7945b640e6168488e4417f9bb96e4ab46c

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Linux 4.15.0-38-generic amd64
$ groovy -version
Groovy Version: 2.5.3 JVM: 1.8.0_181 Vendor: Oracle Corporation OS: Linux
上一篇下一篇

猜你喜欢

热点阅读