[JAVA] Hello World with GWT 2.8.2 and Maven

I wrote Hello World with JavaFX 11 (OpenJFX) in Liberica JDK 11 and Ported a mini game made with JavaFX to a web browser with GWT. See, I missed GWT, and [Getting Started] I tried (http://www.gwtproject.org/gettingstarted.html), so make a note of it.

I'm getting tired of being consistent with the concept of REST in modern web applications, so I'm wondering if GWT is great for client development. As I wrote in Implementing RSocket communication between server and browser client with Spring Boot and rsocket-js, the emergence of protocols like RSocket and gRPC. Given that, it's amazing that GWT hides client-server communication, albeit legacy. Also, given the existence of languages like TypeScript, GWT's Java-to-JavaScript transpile is amazing.

Prerequisites

This article uses the following versions of the tool.

Tool Version
SDKMAN! 5.7.4+362
Java 1.8.0_242
Maven 3.6.3

Checking at the terminal, it looks like the following.

$ sdk version
SDKMAN 5.7.4+362
$ sdk current java
Using java version 8.0.242.hs-adpt
$ sdk current maven
Using maven version 3.6.3
$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)
$ mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/takuya/.sdkman/candidates/maven/current
Java version: 1.8.0_242, vendor: AdoptOpenJDK, runtime: /Users/takuya/.sdkman/candidates/java/8.0.242.hs-adpt/jre
Default locale: en_JP, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"

Install GWT with Homebrew

Update Homebrew before installing GWT. At the time of writing, GWT 2.8.2 was installed.

$ brew update
$ brew install gwt

Once you've installed GWT, make sure you can use webAppCreator.

$ webAppCreator -help
Google Web Toolkit 2.8.2
...

Create a GWT project with webAppCreator and do Hello World

You can create a new GWT project with the following command. You can create a Maven project with the maven option. Please note that if you do not give it, it will be an Ant project. Note that the maven option has been deprecated, and if you use the templates option instead, you can get the same result with -templates maven, sample, readme. You can specify the output directory with the  Ľoutoption.com.example.myapp.MyApp` is the module name.

$ webAppCreator -maven -out myapp com.example.myapp.MyApp

Execute with the following command. Note that if you forget the package, it will not work. I didn't read README.txt properly at first and it didn't work.

$ cd myapp
$ mvn package gwt:devmode

This will launch the following application called GWT Development Mode.

GWT Development Mode

If you click the Launch Default Browser button and display it in the browser, the following screen will be displayed after it is automatically compiled.

Web Application Starter Project

When you click the Send button, the result of communication with the server via RPC is displayed in a dialog.

Remote Procedure Call

This time I tried Hello World with GWT 2.8.2 and Maven. When it comes to building a proper development environment, Eclipse + GWT Eclipse Plugin or IntelliJ IDEA Ultimate seems to be good. Since I was able to build a development environment with both Eclipse and IntelliJ, I will write an article about how to build such a development environment.

References

GWT

Recommended Posts

Hello World with GWT 2.8.2 and Maven
Hello world with Kotlin and JavaFX
Hello World with Eclipse + Spring Boot + Maven
Hello World with Micronaut
Hello World with Spring Boot
Hello World with Spring Boot!
Hello World with VS Code!
Hello World with Spring Boot
Hello World with SpringBoot / Gradle
Hello, World! With Asakusa Framework!
Hello World with Java Servlet and JSP (Easy web server startup with Maven + Jetty)
(Intellij) Hello World with Spring Boot
Create PDF with itext7 ~ Hello World ~
View Slider with GWT and SmartGWT
"Hello world" for ImageJ with Eclipse
Android OS (7.1.2) build and Hello World
Hello world in Java and Gradle
[Swift] Create a project with Xcode (ver 12.1) and display "Hello, World!"
Compare Hello, world! In Spring Boot with Java, Kotlin and Groovy
Hello world with Java template engine Thymeleaf
Java development with Codenvy: Hello World! Run
"Hello, World!" With Kotlin + CLI in 5 minutes
How Spring Security works with Hello World
(IntelliJ + gradle) Hello World with Spring Boot
Minimal Java environment construction and Hello World
Read "Hello world"
Try writing "Hello, World" with a combination of various languages and libraries
Java, Hello, world!
Java Hello World
Hello World with JavaFX 11 (OpenJFX) in Liberica JDK 11
IDE and Maven compile with all debug information
Hello world! With Spring Boot (Marven + text editor)
Build Java environment and output hello world [Beginner]
Run JSP Hello World with Tomcat on Docker
Until you install Gradle and output "Hello World"
[Java] Hello World with Java 14 x Spring Boot 2.3 x JUnit 5 ~
Show a simple Hello World with SpringBoot + IntelliJ
Try to display hello world with spring + gradle
Easy to display hello world with Rails + Docker
"Hello World" in Java
Compile with Java 6 and test with Java 11 while running Maven on Java 8
Hello World (REST API) with Apache Camel + Spring Boot 2
Java Learning (1)-Hello World
Read System.out.println ("hello, world")
Let's write Hello World
Hello world in node.js
Hello World in Java
Studying Java-Part 1-Hello World
Hello World on WebAssembly
Hello World comparison between Spark Framework and Spring Boot
Hello World (console app) with Apache Camel + Spring Boot 2
[Java] One type of alphabet prohibited With binding Hello, world! [Binding]
Hello World with Ruby extension library for the time being
Create a Hello World web app with Spring framework + Jetty
[Vue Rails] "Hello Vue!" Displayed with Vue + Rails
Try gRPC with Java, Maven
java hello world, compile, run
Java beginners read Hello World
Easy library introduction with Maven!
Until you run Hello World of JavaFX with VS Code + Gradle
Try Hello World with the minimum configuration of Heroku Java spring-boot