server option in command line invocation of java

HI,
I was going through the following script :
#!/bin/sh

JAVA_XMS=${JAVA_XMS:=100M}
JAVA_XMX=${JAVA_XMX:=100M}
JAVA_MAIN_CLASS=${JAVA_MAIN_CLASS:=com.risk.MainApplication}

CMD_OPTS=" -server -Xms${JAVA_XMS} -Xmx${JAVA_XMX} -Denv=production -Dserver.port=8093 "

echo "Starting Payment Fraud Search Service"

nohup java $CMD_OPTS -jar payment-fraud-search-1.0.0.jar > nohup.out 2>&1 &

Open in new window


Here i see the java command is passed -server as an option.
What does this mean ?
Will it start a tomcat or webserver ?

Thanks
Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dpearsonCommented:
"-server" in this case is a flag to the Java runtime (the JVM) to tell it that this particular process will be used as a server, rather than as a client app and it should optimize accordingly (e.g. it's OK to be slower on startup and more aggressive about JIT behavior since the process will likely run for a long time).

I believe it's actually the default now for Java anyway - which makes sense since 99% of Java apps these days are run server side (unless we count Android which is a bit of a different beast).

It does not indicate anything about what the process will do - be a webserver etc.  It's just an optimization flag.

Doug

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rohit BajajAuthor Commented:
can a war file also be ran like that ? because it requires a server like tomcat or jetty
from the command i guess it cannot be a web application. please comment
dpearsonCommented:
A war file as you say is run a web container (like Tomcat or Jetty).  It can't be run directly from Java itself - it's an application that requires a container (a web server).

Tomcat or Jetty in turn will take various flags when those Java applications start up.

So it ends up being:
java <flags> tomcat.jar    <-- start running tomcat

tomcat once running
   - loads war file from disk and shows app that you can interact with over the web

Make sense?

Doug
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.