Based on IntelliJ IDEA project to create the first Groovy

1.1 Overview

Groovy is a dynamic language that runs in the Java Virtual Machine, a colleague have scripting language features. When you run Groovy script it will first be compiled into Java byte code class, and then execute the Java JVM bytecode class through virtual machine.

1.2 Configuration Step

Software Version 1.2.1

IntelliJ IDEA 2018.3.5 x64

jdk1.8.0_171

groovy-2.5.7

Configuring JDK

Readers can obtain the latest version of the Java version of Oracle's official website. After the installation is complete configuration after installation, configuration and JRE_HOME JAVA_HOME environment variable. Run the following command indicates JDK installed successfully:

C:\Users\45014>java -version

java version "1.8.0_171"

Java(TM) SE Runtime Environment (build 1.8.0_171-b11)

Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Groovy 1.3 Configuration

Step One: Download and unzip

Download: http://groovy-lang.org/download.html

Extract the directory: D: \ softwareTools \ apache-groovy-sdk-2.5.7

Step Two: Configure environment variables

新建GROOVY_HOME = D:\softwareTools\apache-groovy-sdk-2.5.7\groovy-2.5.7。

Modify PATH, increase% GROOVY_HOME% \ bin

The third step: verifying

In the command line using the groovy -v, if the print version of Groovy test configuration was successful.

D:\softwareTools\apache-groovy-sdk-2.5.7\groovy-2.5.7\bin>groovy -v

Groovy Version: 2.5.7 JVM: 1.8.0_171 Vendor: Oracle Corporation OS: Windows 10

1.4 Download and install Idea

Reference Address: https://www.0daydown.com/02/867195.html

1.4.1 Creating Idea Engineering

  • Create a Project, select Groovy, pay attention to choose Project SDK and Groovy library, the default is no Groovy library, create and select the right button, then select the directory to install their own groovy, then click next
  • Write the project name and select the storage location, click on the finish;
  • Right src Groovy to create a new file, select the Groovy Script

 

 

 

 class TestGroovy
{
    static void main(args)
    {

        def mygreeting = "Hello World"

        println mygreeting
    }
}

 

  

 

 

-----End----

 

Guess you like

Origin www.cnblogs.com/taoweizhong/p/10991434.html
Recommended