-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update getting started (use gwt-maven-archetype) #354
Merged
Merged
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1367a2e
update getting started (use gwt-maven-archetype)
FrankHossfeld 5cbd5a9
fixed typo
FrankHossfeld 20b3980
Merge branch 'main' into getting-started-v2
FrankHossfeld 9c291c7
Merge remote-tracking branch 'origin/getting-started-v2' into getting…
FrankHossfeld 4a15ea6
fixed typo
FrankHossfeld 09e059b
add hint of gwt-maven-springboot-archetype in case you want to create…
FrankHossfeld 47d3e9d
Update src/main/markdown/gettingstarted-outdated.md
FrankHossfeld 911e66d
fixed typo
FrankHossfeld 034049e
add Linux
FrankHossfeld 1f30bf1
review feedback
FrankHossfeld ddabd4b
Merge remote-tracking branch 'origin/getting-started-v2' into getting…
FrankHossfeld 305cf16
update IntelliJ set up
FrankHossfeld d5e8ded
review feedback
FrankHossfeld 03ab43d
Merge remote-tracking branch 'origin/getting-started-v2' into getting…
FrankHossfeld 946a7bd
review feedback - cool URIs don't change
FrankHossfeld 138396b
review feedback
FrankHossfeld c1e6972
review feedback
FrankHossfeld 9d3d1e3
review feedback
FrankHossfeld 34e19db
review feedback
FrankHossfeld File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
Getting Started | ||
=== | ||
|
||
Note: Starting with GWT 2.11.0 the webAppCreator is deprecated. New instructions located [here](gettingstarted.hmtl). | ||
FrankHossfeld marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
* [Prerequisites](#prereqs) | ||
* [Download and Install GWT](#download) | ||
* [Create your first web application](#create) | ||
* [Run locally in development mode](#run) | ||
* [Make a few changes](#change) | ||
* [Compile and run in production mode](#compile) | ||
* [Set up an IDE](#setup) | ||
|
||
## Prerequisites<a id="prereqs"></a> | ||
|
||
1. You will need the Java SDK version 1.8 or later. If necessary, download and | ||
install the Java SE Development Kit (JDK) <a | ||
href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" | ||
rel="nofollow">from Oracle</a> or <a href="https://adoptopenjdk.net/" | ||
rel="nofollow">from Adopt OpenJDK</a> for your platform. | ||
2. Apache Ant is also necessary to run command line arguments in this sample. If | ||
you don't already have it, install <a href="http://ant.apache.org/" rel="nofollow">Apache Ant</a>. | ||
|
||
If you have problems running Ant on the Mac, try setting the | ||
$JDK_HOME environment variable with export JDK_HOME="/Library/Java/Home" | ||
|
||
## Download and Install the GWT SDK<a id="download"></a> | ||
|
||
<table class="download"> | ||
<tbody><tr> | ||
<td> | ||
<img src="images/sdk-sm.png" style="float: left; width: 80px; height: | ||
80px;" /> | ||
</td> | ||
<td> | ||
<p> | ||
<a href='download.html'>Download</a> and unzip the GWT SDK. This contains the core | ||
libraries, compiler, and development server that you need to write web | ||
applications. | ||
</p> | ||
<p> | ||
See <a href="doc/latest/FAQ_GettingStarted.html">FAQ</a> | ||
for system and browser requirements. | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody></table> | ||
|
||
On Windows, extract the files from the compressed folder `gwt-2.10.0.zip`. On Mac or Linux, you can unpack the package with a command like: | ||
|
||
``` | ||
unzip gwt-2.10.0.zip | ||
``` | ||
|
||
The GWT SDK doesn't have an installer application. All the files you need to | ||
run and use the SDK are located in the extracted directory. | ||
|
||
## Create your first web application<a id="create"></a> | ||
|
||
GWT ships with a command line utility called [webAppCreator](http://www.gwtproject.org/doc/latest/RefCommandLineTools.html#webAppCreator) that automatically generates all the files you'll need in order to start a GWT project. It also generates [Eclipse](http://www.eclipse.org/) project files and launch config files for easy debugging in GWT's development mode. | ||
|
||
You can create a new demo application in a new MyWebApp directory by running `webAppCreator`: | ||
|
||
* **Windows** | ||
|
||
``` | ||
cd gwt-2.10.0 | ||
|
||
webAppCreator -out MyWebApp com.mycompany.mywebapp.MyWebApp | ||
``` | ||
|
||
* **Mac or Linux** - you may need to make the script executable: | ||
|
||
``` | ||
cd gwt-2.10.0 | ||
|
||
chmod u+x webAppCreator | ||
|
||
./webAppCreator -out MyWebApp com.mycompany.mywebapp.MyWebApp | ||
``` | ||
|
||
The `webAppCreator` script will generate a number of files in | ||
`MyWebApp/`, including some basic "Hello, world" | ||
functionality in the class | ||
`MyWebApp/src/com/mycompany/mywebapp/client/MyWebApp.java`. The | ||
script also generates an Ant build script `MyWebApp/build.xml`. | ||
|
||
## Run locally in development mode<a id="run"></a> | ||
|
||
To run your newly created application in development mode: | ||
|
||
``` | ||
cd MyWebApp/ | ||
|
||
ant devmode | ||
``` | ||
|
||
This command starts GWT's development mode server, a local server used for development and debugging, as follows: | ||
|
||
<div class="screenshot"><a href="images/myapplication-devmode.png"><img src="images/myapplication-devmode.png" alt="Screenshot" width="35%"/></a></div> | ||
|
||
Launch the local server in a browser by either 1) clicking "Launch Default Browser" | ||
or 2) clicking "Copy to Clipboard" (to copy its URL), then pasting into Firefox, Internet Explorer, | ||
Chrome, or Safari. | ||
|
||
The starter application will load in Super Dev Mode as follows: | ||
|
||
<div class="screenshot"><a href="images/myapplication-browser.png"><img src="images/myapplication-browser.png" alt="Screenshot" width="35%"/></a></div> | ||
|
||
## Make a few changes<a id="change"></a> | ||
|
||
The source code for the starter application is in the | ||
`MyWebApp/src/` subdirectory, where MyWebApp is the name you gave to | ||
the project above. You'll see two packages, | ||
`com.mycompany.mywebapp.client` and | ||
`com.mycompany.mywebapp.server`. Inside the client package is code that will eventually be compiled to JavaScript and run as client code in the browser. The java files in the server package will be run as Java bytecode on a server, in the case of this Quick Start on the App Engine servers. | ||
|
||
Look inside `com/mycompany/mywebapp/client/MyWebApp.java`. Line 41 constructs the "Send" button. | ||
|
||
``` | ||
final Button sendButton = new Button("Send"); | ||
``` | ||
|
||
Change the text from "Send" to "Send to Server". | ||
|
||
``` | ||
final Button sendButton = new Button("Send to Server"); | ||
``` | ||
|
||
Now, save the file and simply click "Refresh" in your browser to see your change. The button should now say "Send to Server" instead of "Send": | ||
|
||
## Compile and run in production mode<a id="compile"></a> | ||
|
||
To run the application as JavaScript in what GWT calls "production mode", compile the application by executing: | ||
|
||
``` | ||
ant build | ||
``` | ||
|
||
The "build" Ant target invokes the GWT compiler which generates a number of | ||
JavaScript and HTML files from the MyWebApp Java source code in the | ||
`MyWebApp/war/` subdirectory. To see the application, open the file | ||
`MyWebApp/war/MyWebApp.html` in your web browser. The application | ||
should look identical to the development mode above. | ||
|
||
Congratulations! You've created your first web application using GWT. | ||
Since you've compiled the project, you're now running pure JavaScript and | ||
HTML that works in IE, Chrome, Firefox, Safari, and Opera. You could now deploy | ||
your application to production by serving the HTML and JavaScript files in your | ||
`MyWebApp/war/` directory from your web servers. | ||
|
||
## Set up an IDE<a id="setup"></a> | ||
|
||
Now that you've created your first app, you probably want to do something a | ||
bit more interesting. But first, if you normally work with an IDE you'll want to | ||
set up Eclipse to use the GWT SDK: | ||
|
||
[Set up Eclipse](usingeclipse.html) | ||
|
||
If you are going to stick with the command line, check out Speed Tracer and then | ||
head over to [Build a Sample GWT App](doc/latest/tutorial/gettingstarted.html). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool URIs don't change - If we're moving the old content to a new page, we should link it from the "current" one, otherwise this page isn't going to be easy to find for those who could need it. On the other hand, if we think we should just entirely remove it, let's remove it, rather than keeping it but hard to find.
I don't think it would be unreasonable to keep the old contents on the existing page either, but all the way at the bottom with a "deprecated" header (so that old anchors could still work)?
I'm not sure if I have a preference from the three choices... probably "move to new page, but link it properly, with a plan to delete in the future", but only a very mild preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. Missed it.