How can I configure apache tomcat to use a different java home when installed as a windows service?

I want to redistribute tomcat as part of my application. I will also be distributing the bundled jre and I need to install the application installer a) install the tomcat service on Windows and b) not use JAVA_HOME if it is already installed on the machine. That is, I need tomcat to point to my associated jre.

I read here so you can pass the tomcat6w.exe command line parameter to change the jre that tomcat uses. Will this change persist even after stopping tomcat service?

I also noticed that the tomcat service manager program saves its settings in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\Tomcat6\Parameters

. Is it enough to change the Java \ Jvm key to the jvm.dll of my associated jre?

+2


source to share


2 answers


The tomcat6.exe file that comes with the distribution has command line switches to do all this. It also comes with service.bat, which does some of the work for you. I ended up modifying the service.bat by passing in the -Jvm switch with the jvm location I wanted to use.



+3


source


The change will be saved. It makes changes to the registry - you can also use tomcat6w to do things like change memory arguments, catalina_home, catalina_base, etc.



How easy it is to change the key to the associated jre - I haven't tried that. Let me know if it works? Thank.

+2


source







All Articles