简体   繁体   中英

How to run Java file on Google Cloud VM?

I want to run a java file on a VM instance I've created in Google Cloud under Compute Engine. However, it's not clear how to do this. I pressed SSH and uploaded the java file but I dont know what to do after that. It doesn't allow me to start the VM. Please, does anyone know how to do this? Run a simple java file on Google Cloud's VM?

You can't SSH into a VM that hasn't been started so the fact that you can SSH into the VM implicitly means it has been started.

If the .java file is accessible to the VM and the relevant JDK has been installed on your VM, you can compile and then it run like you'd run any other Java program. You can use javac for the compilation and java to run the compiled .class file. You can take a look at this article for more info on how to do that.

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