Run Java Console Application
Java Console Application with CentOS VPS
Deployment Workflow
Install Java on the VPS
Connect to the CentOS VPS over SSH using either the platform SSH Gate or the node’s public IP address.
1Download the required Java package
Use wget with the URL of the Java package you want to install:
wget {utility_address}
Replace {utility_address} with the appropriate Java download URL.
2Install the downloaded RPM
rpm -ivh {java_rpm_package}
Replace {java_rpm_package} with the downloaded RPM package name.
3Verify the Java installation
java -version
Upload the Java Application
Prepare the standalone Java application as a .jar archive. The source example uses an application named vdssocket.jar that listens for incoming connections on port 7777 and returns the request time and remote address.
1Connect with a file-transfer client
The source uses WinSCP. Connect to the VPS with the credentials received after server installation.
- Host name — the attached public IP address.
- User name — the VPS login, typically
rootin the source example. - Password — the password received after VPS provisioning.
2Create an application directory and upload the JAR
Navigate to the VPS home directory, create a folder named standalone_java, and upload the JAR archive into it.
standalone_java directory.Access and Run the Application via SSH
1Open the application directory
cd /home/standalone_java/ ls
Confirm that the application JAR is present.
2Start the application
java -jar vdssocket.jar
In the source example, the console confirms that the socket listener is active on port 7777.
Check Application Operability
The source tutorial tests the listener with a Telnet client. Connect to the VPS public IP and the port used by the Java application.
o {public_IP_address} {port_number}
{public_IP_address}— the external/public IP attached to the VPS.{port_number}— the port where the Java application is listening,7777in the example.
If the application is working correctly, the client receives information that includes the request time and the remote address.
Switch back to the SSH session. The Java console should report that a new client has connected and display the client’s remote address.
java -jar, and test the listening port through the VPS public IP.
