You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You now have a functioning Git repository that contains a simple Java application. The application includes a `pom.xml` file, which is used by Java's dependency manager, Maven.
@@ -135,7 +135,8 @@ By default, Heroku generates a random name (in this case `warm-eyrie-9006`) for
135
135
Now deploy your code:
136
136
137
137
```term
138
-
:::>> $ git push heroku master
138
+
:::>- $ git push heroku master
139
+
:::-> | $ (head -6; echo "..."; tail -18)
139
140
```
140
141
141
142
The application is now deployed. Ensure that at least one instance of the app is running:
@@ -157,20 +158,9 @@ Heroku aggregates all of the output streams from both your app and the platform'
157
158
View information about your running app using the `heroku logs --tail` command:
158
159
159
160
```term
160
-
$ heroku logs --tail
161
-
2017-04-20T15:06:14.198559+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Dserver.port=43161 -jar target/java-getting-started-1.0.jar`
162
-
2017-04-20T15:06:16.478043+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
163
-
2017-04-20T15:06:16.484066+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2017-04-20T15:06:33.472964+00:00 app[web.1]: 2017-04-20 15:06:33.472 INFO 4 --- [ main] com.example.Main : Started Main in 15.345 seconds (JVM running for 16.989)
173
-
2017-04-20T15:06:33.778990+00:00 heroku[web.1]: State changed from starting to up
Visit your application in the browser again to generate another log message.
@@ -183,7 +173,7 @@ Heroku apps use a special plaintext file called the [Procfile](procfile) to expl
183
173
184
174
The `Procfile` in the example app you deployed looks like this:
185
175
186
-
```
176
+
```yaml
187
177
:::-> $ cat Procfile
188
178
```
189
179
@@ -246,7 +236,8 @@ Another file, `system.properties`, indicates the version of Java to use (Heroku
246
236
Run `mvn clean install` in your local directory to install the dependencies, preparing your system for running the app locally. Note that this app requires Java 8, but you can push your own apps using a different version of Java.
247
237
248
238
```term
249
-
:::>> $ mvn clean install
239
+
:::>- $ mvn clean install
240
+
:::-> | $ (echo "..."; tail -7)
250
241
```
251
242
252
243
If you do not have Maven installed, or get an error like `'mvn' is not recognized as an internal or external command`, then you can use the wrapper command instead by running `mvnw clean install` on Windows or `./mvnw clean install` on Mac and Linux. This both installs Maven and runs the Maven command.
@@ -275,7 +266,8 @@ Once dependencies are installed, you can run your app locally.
275
266
Start your application locally with the `heroku local` CLI command (make sure you've already run `mvn clean install`):
@@ -432,7 +425,8 @@ Deploy your updated application to Heroku to see this in action.
432
425
The `heroku run` command lets you run maintenance and administrative tasks on your app in a [one-off dyno](one-off-dynos). It can also lets you launch a REPL process attached to your local terminal for experimenting in your app's environment, or code that you deployed with your application:
433
426
434
427
```term
435
-
:::>> $ heroku run java -version
428
+
:::>- $ heroku run java -version
429
+
:::-> | $ tail -4
436
430
```
437
431
438
432
If you receive an error, `Error connecting to process`, then you might need to [configure your firewall](one-off-dynos#timeout-awaiting-process).
@@ -503,7 +497,7 @@ The example app you deployed already has database functionality, which you can r
503
497
The code to access the database is straightforward. Here's the method to insert values into a table called `tick`:
504
498
505
499
```java
506
-
:::-> $ sed -n '45,49p;90,109p' src/main/java/com/example/Main.java
500
+
:::-> $ sed -n '45,50p;78,109p' src/main/java/com/example/Main.java
507
501
```
508
502
509
503
This ensures that when you access your app using the `/db` route, a new row is added to the `tick` table, and all rows are then returned so that they can be rendered in the output.
0 commit comments