Reputation: 57
I have been trying to import a Java project that I have developed on my own personal computer with IntelliJ to Google Compute Engine with no success. I have created a VM instance, but I do not know how to import my project and run it. I haven't found much information on this as most tutorials are about deploying web applications.
My project is not a web application and no servers are involved, I just would like to take advantage of the computing power that Google offers to execute the program in less time.
I would be grateful if you could provide me with some guidance on how to do that or point me to a relevant tutorial.
Upvotes: 2
Views: 2785
Reputation: 13424
Assuming your Java application compiles to a JAR file, you can:
create a Google Compute Engine VM instance
You can use either GCP Console to do this, or gcloud compute instances create
.
upload the JAR file to the VM
You can use gcloud compute scp
to accomplish this.
SSH to the VM
You can do this via Google Cloud Shell, or via gcloud compute ssh
.
run your program while logged in to the VM
Ensure that your software is written appropriately to take advantage of the multiple CPUs, GPUs, etc. the VM has to ensure it has maximum performance.
If this is a long-running process that you want to make sure doesn't accidentally get interrupted (e.g., because your SSH session times out, or you close your browser window which as the Cloud Shell connection), consider using either nohup
(easiest, especially for one-off runs) or running the command interactively in a detachable session such as screen
or tmux
(more involved).
Upvotes: 3