简体   繁体   English

如何在 Google Cloud VM 上运行 Java 文件?

[英]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.

相关问题 如何访问在谷歌云平台上创建的虚拟机 - How to access VM created on google cloud platform 如何访问部署在谷歌云虚拟机上的网站? - How to access website deployed on Google cloud VM? 从Google托管VM(自定义/ Java)连接到Google Cloud Datastore? - Connect to Google Cloud Datastore from Google Managed VM (Custom/Java)? 在 Google Compute Engine VM 上执行 Java 文件 - Execute Java file on Google Compute Engine VM 如何使用WAR文件将Java应用程序部署到Azure云服务(不是VM或App Service)? - How do I deploy my Java Application to Azure Cloud Service(not VM or App Service) using a WAR file? 如何在云上使用tomcat 8运行java应用程序(war文件)? 在哪里? - How to run java application(war file) using tomcat 8 on cloud? & Where? 从 Java 调用 Google Cloud Run - Invoke a Google Cloud Run from java 如何使用Java在Google Cloud Storage中插入pdf文件 - How to insert a pdf file in Google Cloud Storage using Java 如何使用Java API更新Google Cloud Storage中文件的ACL - How to update ACL of a file in Google Cloud Storage using Java API 如何使用java上传谷歌云存储中的文件 - How to upload a file in the google cloud storage using java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM