LoginSignup
0
0

More than 3 years have passed since last update.

Java/IntelliJ/Gradle で HelloWorld を行う

Last updated at Posted at 2020-09-30

環境

  • Windows10
  • Java8
  • IntelliJ IDEA
  • Gradle

Project を作成する

File > New > Project で、Gradle/Java を選び、Next を押下します。
01.png

Name に任意に入力します。(ef.SpringBootSample)
GroupId と ArtifactId を設定します。(今回はデフォルトです)
最後に Finish を押下すると Project が作成されます。
02.png

HelloWorld を行う

左側にある Project ペインのルートプロジェクトを右クリックし、
New > Directory より、src > main > java を選択し、Enter キーを押下するとフォルダが作成されます。
03.png

作成した java フォルダを右クリックし、New > Packageより、
org.example と入力し、Enter キーを押下します。
04.png

さらに、example フォルダを右クリックし、New > Classより、
Class が選択された状態で Main と入力し、Enter キーを押下します。
06.png

作成したクラスに以下を記載します。

Main.java
package org.example;

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

Main.main() を実行します。

4:33:31: Executing task 'Main.main()'...

> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes

> Task :Main.main()
Hello World

これで IntelliJ で Java コードが書けるようになりました。

0
0
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
0