Tomcat server is started using the startup.bat file under bin folder. To start a Tomcat server from command prompt, user is required to hit the command startup.bat and tomcat server gets started in the new command prompt.
To start a server from Java code, its required to create a process of the batch file and execute the process. Below is the source code of the same.
The tomcat server path and the port is mentioned in the properties file along with the Java Path. Properies file is read in the batch file to set the values of Catalina Home and Java Home. If the values are not set in the environment variable for CATALINA_HOME & JAVA_HOME, then they are picked from properties file.
Here is the complete source code.