Deploying Java Web Projects to Heroku

Source: Internet
Author: User
Tags java web

1. Create a new app on Heroku

2. After successful creation, add support for MySQL, click Find more Add-ons

3. I chose Jawsdb Mysql here.

4. We can view the configuration of the database after the successful addition

5. Then connect to the remote database locally via MySQL Workbench and execute the appropriate SQL statement to create the database and table required by the application

6. Then we need to change the settings of the database connection file in the Web project to the corresponding configuration above

7.---Focus, then we introduce the Mysql-connector.jar package required to connect MySQL into the Web-inf file, which must be introduced, if only the local add Mysql-connector.jar package into the reference direct export, on the remote server, running the app attempt to connect to the database, will report class not found error. On the project, right-click to select Propertise.

8. After joining, we right-click on the project and select Export-to-war file, where I export the war to the desktop

9. Next we add the local command line support for Heroku.

Install Heroku by linking Https://devcenter.heroku.com/articles/heroku-cli#download-and-install.

Installing a plug-in to deploy war by Heroku plugins:install heroku-cli-deploy directive

10. We then log in to Heroku.

The instructions to deploy the war file to the server are as follows:

11. Done. We can access our app via the URL in the red box.

Deploying Java Web Projects to Heroku

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.