Set up simple Java Web App to run on local eclipse and Heroku
Install Heroku toolbelt: https://toolbelt.heroku.com/
Install Maven: http://maven.apache.org/download.cgi#Installation_Instructions
Maven plugin for Eclipse: http://eclipse.org/m2e/ (optional)
Login to your Heroku Dashboard
Install Maven: http://maven.apache.org/download.cgi#Installation_Instructions
Maven plugin for Eclipse: http://eclipse.org/m2e/ (optional)
Login to your Heroku Dashboard
Click on the + on the right top corner, and find an appealing untaken name for your application
Click "Create" and leave the page that appeared open, move back to your Eclipse
Create a dynamic Web project
Convert it to Maven project (OPTIONAL)
Download the files below, modify as needed and store them in the file structure as shown below
Download as pom.xml
pom.xml |
Download as Procfile
procfile |
Download as Main.java
main.java |
add index.html file
Follow the commands you have from Heroku in your broswer window
Follow the commands you have from Heroku in your broswer window
$ heroku login
Enter your Heroku credentials.
Email: ...
Password (typing will be hidden):
Authentication successful.
$ git init
Initialized empty Git repository in ...
$ heroku git:remote -a unh
Git remote heroku added
$ git add .
$ git commit -am "make it better"
[master (root-commit) 16a7047] make it better
15 files changed, 342 insertions(+)
create mode 100644 .classpath
create mode 100644 .gitignore
create mode 100644 .project
create mode 100644 .settings/.jsdtscope
create mode 100644 .settings/org.eclipse.jdt.core.prefs
create mode 100644 .settings/org.eclipse.m2e.core.prefs
create mode 100644 .settings/org.eclipse.wst.common.component
create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml
create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container
create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.name
create mode 100644 .settings/org.eclipse.wst.validation.prefs
create mode 100644 WebContent/META-INF/MANIFEST.MF
create mode 100644 WebContent/index.html
create mode 100644 pom.xml
create mode 100644 src/main/java/launch/Main.java
$ git push heroku master
Counting objects: 24, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (24/24), 4.38 KiB | 0 bytes/s, done.
Total 24 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Java app detected
remote: -----> Installing OpenJDK 1.8... done
...
$ heroku ps:scale web=1
$ heroku open
Enter your Heroku credentials.
Email: ...
Password (typing will be hidden):
Authentication successful.
$ git init
Initialized empty Git repository in ...
$ heroku git:remote -a unh
Git remote heroku added
$ git add .
$ git commit -am "make it better"
[master (root-commit) 16a7047] make it better
15 files changed, 342 insertions(+)
create mode 100644 .classpath
create mode 100644 .gitignore
create mode 100644 .project
create mode 100644 .settings/.jsdtscope
create mode 100644 .settings/org.eclipse.jdt.core.prefs
create mode 100644 .settings/org.eclipse.m2e.core.prefs
create mode 100644 .settings/org.eclipse.wst.common.component
create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml
create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container
create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.name
create mode 100644 .settings/org.eclipse.wst.validation.prefs
create mode 100644 WebContent/META-INF/MANIFEST.MF
create mode 100644 WebContent/index.html
create mode 100644 pom.xml
create mode 100644 src/main/java/launch/Main.java
$ git push heroku master
Counting objects: 24, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (24/24), 4.38 KiB | 0 bytes/s, done.
Total 24 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Java app detected
remote: -----> Installing OpenJDK 1.8... done
...
$ heroku ps:scale web=1
$ heroku open
You should now be able to run your application in local Tomcat within eclipse, in embedded Tomcat locally and on Heroku