java 如何把Java程序放到网上?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7311136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to put Java program online?
提问by Dead_Jester
I am learning Java and am trying to do some experiments with networking Java programs.
我正在学习 Java 并且正在尝试使用网络 Java 程序做一些实验。
I have a program made in 2 parts with a client and a server and it works in local testing but the program actually has usefulness for me and a friend of mine and I want to put the server online so both of us can connect to it and use it.
我有一个由两部分组成的程序,一个客户端和一个服务器,它在本地测试中工作,但该程序实际上对我和我的一个朋友很有用,我想把服务器放在网上,这样我们俩都可以连接到它,用它。
Where/How can I put the program online and have it running so that the client programs can connect to the ServerSocket with an ip address? (Preferably free)
我在哪里/如何将程序联机并运行,以便客户端程序可以使用 IP 地址连接到 ServerSocket?(最好是免费的)
回答by HRgiger
If you dont want to pay server hosting then I would open a virtual server on my computer, then playaround with modem and forward related port to server ip. I would use a port more than 40000. Then just send your ip and port your friend or update application.
如果您不想支付服务器托管费用,那么我会在我的计算机上打开一个虚拟服务器,然后使用调制解调器进行播放并将相关端口转发到服务器 IP。我会使用超过 40000 的端口。然后只需发送您的 ip 并移植您的朋友或更新应用程序。
回答by surya
If you really want the application to go live within 5 mins, try Jelastic. If you have built a WAR file, simply sign up with their server,choose a provider closest to your geo location, configure Tomcat and you can upload the WAR file through their fantastic web console. Otherwise if you have some source control system(SVN,GIT etc), you just connect and build it with their Maven console and you can be ready. I used it for my start up(Cloudlabz) and really found it exciting.
如果您真的希望应用程序在 5 分钟内上线,请尝试Jelastic。如果您已经构建了 WAR 文件,只需在他们的服务器上注册,选择离您的地理位置最近的提供商,配置 Tomcat,您就可以通过他们出色的 Web 控制台上传 WAR 文件。否则,如果您有一些源代码控制系统(SVN、GIT 等),您只需使用他们的 Maven 控制台连接并构建它,您就可以准备好了。我将它用于我的启动(Cloudlabz)并且真的发现它令人兴奋。
Surya
苏里亚
回答by sbrattla
You could also consider the cheapest Rackspace Cloud Server. You'll get a full fledged Linux server (distribution of your choice) for about USD 11/month. I've done that now and then myself to try things out.
您还可以考虑最便宜的 Rackspace 云服务器。您将获得一个完整的 Linux 服务器(您选择的分发版),费用约为 11 美元/月。我不时这样做,然后自己尝试一下。
Just install Java on it and you're good to go.
只需在其上安装 Java 即可。
http://www.rackspace.com/cloud/cloud_hosting_products/servers/pricing/
http://www.rackspace.com/cloud/cloud_hosting_products/servers/pricing/
回答by Walllzzz
You should host the server in Heroku ,they offer a free hosting with limits , I have an app there
您应该在 Heroku 中托管服务器,他们提供有限制的免费托管,我在那里有一个应用程序
回答by Kit Ho
is that what you want for this?
这就是你想要的吗?
This is a free web app for you to run your program online....so you can just paste your code and run it.
这是一个免费的网络应用程序,您可以在线运行您的程序......所以您只需粘贴您的代码并运行它。
回答by Captain Haddock
On the cloud you could use two different services in order to host your Java application.
在云上,您可以使用两种不同的服务来托管您的 Java 应用程序。
- IaaS (Infrastructure as a Service). Where you can just rent a specific infrastructure on the cloud and you could install and configure all the services that you need.
- PaaS (Platform as a Service). In this case, you still enjoy the infrastructure on the cloud + the service Aaren full pre-configured. It means that you can deploy your application without installing or configuring anything. You just need to deploy your application. You have an example about how it works here. Also, you usually can test your Java apps on the cloud without paying.
- IaaS(基础设施即服务)。您可以在云上租用特定的基础设施,然后安装和配置您需要的所有服务。
- PaaS(平台即服务)。在这种情况下,您仍然可以享受云上的基础设施 + Aaren 完全预先配置的服务。这意味着您无需安装或配置任何东西即可部署应用程序。您只需要部署您的应用程序。你有一个关于它如何工作的例子here。此外,您通常可以在云上测试您的 Java 应用程序,而无需付费。