I have developed a server [server.jar], and it is now working well (on my localhost). Now I want to "put" this server.jar on my remote server (ie: 122.152.12.33) and run it there, so My client application Replace "Localhost" with this ip and connect the [server.jar]...
How may I do that?
I found answers but didn't understand them (WAR? , and some configurations).
I am using NetBeans IDE. Deployment of Jar file and converting to war using netbeans.
Note I also use Mysql Database that I must upload it on the server side.
*Update: Another related Question:
If I want to try my server.jar on an existing website (Wordpress released site), just by adding my project in a folder, may this harm the online site?
And may I use php to run the Jar? (the site that is online is Link. I want to a create a folder http://akhbarna.com/MyPrject/ ... and then put the Jar there and run it by Php. Is it possible? And how this may effect the Online site?
Running in your IDE is a long way from released and working ;-)
Your question is quite general, so my answer is quite general too but covers the basic approach.
The key to this is thinking what would be needed to run a hello world application on a brand new desktop PC - you'd need to install Java, create a folder to contain your application and some scripts that run the program then copy your jar to the new desktop PC and run those scripts. It's no different on the server, only you'll probably be using 3rd party libraries and will probably install more than just Java.
Before we get to some more details, first off, the terms in the build, release and deployment space tend to be horribly overloaded. To clarify, in the following answer I mean the following:
I'll assume you're starting from scratch and are working in a professional environment.
First thing to do is prepare your server. Like you did with your desktop, you're going to need to install some software - at a bare minimum Java and MySQL plus a Servlet container such as Tomcat if you're building a web-app. You've got two options, either you do these installations manually or use a tool like Puppet to automate them - I'd recommend the later because once setup you can build a server in minutes rather than days.
Then you're going to need some sort of build process that's separate from your IDE. Current popular tools for this are Maven or Gradle. The aim of the build is to produce an artifact containing everything that must be added to the server for your application to be installed. In the case of a stand-alone application this could be a zip with want amounts to a disk image in it (the jar(s), configuration, start/stop scripts) or in the case of a web-app a war, which is the standard deployment structure for a web-app.
Next you're going to need some sort of release process for your application and database scripts. I'm most familiar with Maven that is capable of creating jars, wars, propriatary zips or packages and which, with the use of its Release Plugin, performs all the updates, VCS tagging and deployment (into a repository such as Nexus) needed to perform a release. The database is a bit more tricky and is normally dictated by the DBAs who will apply the database changes - typically you end up with the scripts needed to create and modify the database plus a master script that runs those scripts in the correct order. Pop those in a zip and into the repository for safe keeping too.
Once you've released, you need some way to take the artifacts from the repository and install them onto the server. Obviously this can be done manually or with scripts but again I'd recommend using Puppet, at least for the artifacts targetted at the server. With the database scripts, while this can be automated too, it's more common to connect to the database and apply the scripts manually using a database console (don't forget to take backup of both code and database prior to installing a new version).
Finally you can start your system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With