简体   繁体   中英

Execute Java file on Google Compute Engine VM

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.

Assuming your Java application compiles to a JAR file, you can:

  1. build your application locally on your workstation
  2. create a Google Compute Engine VM instance

    You can use either GCP Console to do this, or gcloud compute instances create .

  3. upload the JAR file to the VM

    You can usegcloud compute scp to accomplish this.

  4. SSH to the VM

    You can do this via Google Cloud Shell , or viagcloud compute ssh .

  5. 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 (eg, 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM