I have access to a server using SSH. I need to run a stand-alone Java application on i开发者_开发百科t to access a MySQL server installed there. How do I go about in doing this?
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
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
精彩评论