Apache Tomcat, Application, CentOS, CentOSVDS, Cloud computing, Console application, Elastic VDS, ENTerprise Operating System, FTP, IaaS, IP address, Java, Java Virtual Machine, Jelastic, PaaS, PaaS vs IaaS, SCP, SFTP, Telnet, VDS, Virtual dedicated server
Run Java Console Applications in the Cloud
Install Java to VDS
rpm -ivh {java_rpm_package}
Create Java application
1. Create your Java Console application.
2. As an example we use app, which is going to listen to the connections on your port. Here you can see our Java code:
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
public class VdsSocket {
public static void main(String[] args) {
try {
int port = 7777;
InetAddress thisIp = null;
ServerSocket ss = new ServerSocket(port);
System.out.println("*************************************");
System.out.println("Socket Listener listens port: " + port);
System.out.println("*************************************");
while (true) {
Socket s = ss.accept();
String address = s.getRemoteSocketAddress().toString();
System.out.println("new client has been detected:");
System.out.println("Socket. Remote Address: " + address);
ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream());
oos.writeObject("Request time: "+ new Date());
oos.writeObject("Socket. Remote Address: " + address);
}
} catch (IOException ex) {
}
}
}
Upload application to VDS
1. Now you need to upload the .jar file of your Java application to VDS. As an example we’ll use vdssocket.jar.
2. For uploading we use WinSCP (SFTP, SCP, and FTP client for Windows).
Before starting you should:
- Install WinSCP ;
- Connect to your VDS using credentials which you’ve got while creating the environment.
In our case:
4. Now you can simply drag the .jar file and drop it in the remote file panel. By default, the transfer settings dialog will appear. Just press Copy and the upload will start. Once it is finished, you will see uploaded file in the remote file panel.

Configure application in VDS
Check the work of standalone application
- PaaS vs IaaS? Combine them instead! (jelastic.com)
From → HowTo







Trackbacks and Pingbacks