0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Gradleインストール

Last updated at Posted at 2019-08-20

目次

はじめに

はじめてJavaを使用するときにメモったGradleのセットアップ失敗と成功の記録です。(2018.02)

Javaの設定

Gradle動作の前提としてJavaを設定します。

JAVA_HOMEの設定

C:\Users\user>set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_161\bin"

javaのバージョン確認

C:\Users\user>java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) Client VM (build 25.161-b12, mixed mode, sharing)

Gradleインストール

Gradleのダウンロードと展開

  1. 公式サイトからダウンロード
     https://gradle.org/

  2. 適当なフォルダに解凍

PATHの設定

Gradleを解凍したフォルダのパスを設定

C:\Users\user>set PATH=%PATH%;C:\tmp\gradle-4.5.1\bin

Gradleのバージョン確認(失敗)

C:\Users\user>gradle -v

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_161\bin

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

※ JAVA_HOME に bin まで書いてしまうとダメらしい。

JAVA_HOMEの設定(再)

C:\Users\user>set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_161"

Gradleのバージョン確認(成功)

C:\Users\user>gradle -v

------------------------------------------------------------
Gradle 4.5.1
------------------------------------------------------------

Build time:   2018-02-05 13:22:49 UTC
Revision:     37007e1c012001ff09973e0bd095139239ecd3b3

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_161 (Oracle Corporation 25.161-b12)
OS:           Windows 7 6.1 x86
0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?