How to Create Java Development Environment In Google Cloud Platform
In this blog, I will discuss How to Create Java Development Environment In the Google Cloud Platform.
Creating and Connecting to a Virtual Machine
- In the GCP Console go to Navigation Menu >Compute Engine> VM Instance.
- Click on Create Instance
- Configure the following settings:
Name: dev-instance
Region: us-central1 (Iowa)
Zone: us-central1-a
Machine configuration: N1
Identity and API: Select Allow full access to all Cloud APIs.
Firewall: Enable Allow HTTP traffic.
Leave the remaining settings as their defaults, and click Create.
- On the VM instances page click on SSH.
- It will launch a browser-hosted SSH session.
Installing software on the VM instance
- In the SSH session, we have to update the Debian package list, copy-paste the command.
sudo apt-get update
- Now install Git, copy-paste the command.
sudo apt-get install git
Enter y to continue because we are accepting the use of additional disk space.
- Now Install Maven
sudo apt-get install -yq maven
- Configure the IP tables
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
This command to configure the IP tables redirects requests on Port 80 to Port 8080.
Configure the VM to Run Application Software
- Now check the Java version.
java --version
- Clone the repository you want.
git clone https://github.com/mayankchourasia/
- Run the web application.
mvn yourfilename:run
- And check your output by clicking External IP of VM.
- To run a simple Java application that lists Compute Engine instances, execute the following command.
mvn exec:java@list-gce
Conclusion
In the article, I give a view that how we can Set up a Java Development Environment.
Thanks for reading.
If you Want to Connect with Me:
Linkedin: https://www.linkedin.com/in/mayank-chourasia-38421a134/
Twitter: https://twitter.com/ChourasiaMayank.
Thank you stay safe, stay healthy.
Stay tuned till the next blog.
Google Developers Google Cloud JavaScript Daily Google Cloud Developer Community Torino