[英]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.我想在我在 Compute Engine 下的 Google Cloud 中创建的 VM 实例上运行一个 java 文件。 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.
我按下 SSH 并上传了 java 文件,但之后我不知道该怎么做。 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?
在 Google Cloud 的 VM 上运行一个简单的 java 文件?
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.您无法通过 SSH 连接到尚未启动的 VM,因此您可以通过 SSH 连接到 VM 的事实隐式意味着它已启动。
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.如果
.java
文件可被 VM 访问,并且相关的 JDK 已安装在您的 VM 上,则您可以像运行任何其他 Java 程序一样对其进行编译和运行。 You can use javac
for the compilation and java
to run the compiled .class
file.您可以使用
javac
进行编译,使用java
运行编译后的.class
文件。 You can take a look at this article for more info on how to do that.您可以查看本文以获取有关如何执行此操作的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.