I have written server-socket Java application (not a web application) and I have a server running on Linux machine. How do I deploy this application so that I can request from anywhere from any app (assume the app has permission). Should I install eclipse/netbeans IDE on server machine and then run the code forever? Or is there any application like tomcat/xampp which will run my server code like Java/other web application.
First off, your question lacks any research effort as this is a very common thing done on many, many websites.
Or is there any application like tomcat/xampp which will run my server code like Java/other web application.
Yes. Depending on your deployment and code-base, you'll need to find a translation mechanism between the web service and the app. Tomcat is a perfect solution for Java code, but there are plenty of others out there that may be better for your specific application.
You should do your own research first, then come here when you have specific questions.
It is reasonable question but may well be poorly asked. Its Java code so you run it on a Java enable web-server right.... nothing else will understand the code. The alternatives to Tomcat are Glassfish, Wildfly/JBoss. But if this is just a lightweight socket-based program this could be more than you need and you may well be able to just use Java SE and run the compiled '.jar' from the command line like so:
Computer> java -jar <path>/<jar-name>.jar
making sure the terminal has relevant permissions to both create/read/write to sockets.
As O King points out, running the compiled .jar file using Java would work. If you need it to run indefinitely without having to keep your terminal open (as your question title indicates) you would have to take additional steps.
'nohup' is probably the simplest way to keep something running after ending your ssh session.
> nohup command-or-script-name &
The methods and best practices for getting your service to start/stop/run as a service is slightly different depending on which Linux distro you're using, which you haven't provided.