简体   繁体   中英

How to set up a java server on AWS EC2

I have made a 2 player game in java for my class but I am looking to make it online. Currently it is set up and running on my localhost socket = new Socket("localhost", 30000);. However I have been reading into how to set up a server. I have set up an AWS account and have an instance if EC2 up and running with java installed on it. I am hoping someone can tell me how do I set up the server or are there any good tutorials on setting up the server on EC2. Also when it is set up what do I replace localhost with?

Thank you so much!

I am hoping someone can tell me how do I set up the server

Same way you run it on your local computer. Just... run it. ssh into your EC2 server as normal and run java -jar yourapp.jar . There's nothing magical going on.

Also when it is set up what do I replace localhost with?

The IP address of your server, which is listed in the AWS console.

Note that you'll need to configure the security group that your AWS instance is in, and open up port 30000.

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