codix
codix

Reputation: 275

Running Java application on server

I have access to a server using SSH. I need to run a stand-alone Java application on it to access a MySQL server installed there. How do I go about in doing this?

Upvotes: 0

Views: 270

Answers (2)

Sanjay T. Sharma
Sanjay T. Sharma

Reputation: 23208

Assuming you have the requirement to copy the JAR file on the *nix box and then run it(and not connect a Java process to it remotely)

  • Create a standalone JAR which contains all the dependencies required to run the application
  • Make sure you have Java installed on that machine
  • Assuming it's a *nix box, set the $PATH environment variable to point to $JAVA_HOME/bin
  • Log on to that box using a SSH client. Any decent SSH client also comes with a FTP plugin which allows you to transfer files between your local box and the server
  • Copy the JAR to the appropriate directory and run it using the java -jar your.jar command

Upvotes: 1

fatnjazzy
fatnjazzy

Reputation: 6152

Assuming it is a linux machine, you have to connect to by using SSH it and use scp command to upload the files and deploy it... than you have to run the JAR you deployed:

java -jar /path/to/file.jar

Or, provide more details please

Upvotes: 1

Related Questions