Howto set JAVA_OPTS when Alfresco is running as a Windows service

Background: If Alfresco runs on a Windows server (in production) you want it to run as a service so that Alfresco is automatically started if the server is rebooted for some reason.

This describes how you set JAVA_OPTS for Alfresco as a Windows service.

  1. Open up the Windows services manager (Start… run… services.exe) and locate the Tomcat service for your Alfresco installation. (If started, shut down the service.)
  2. Double-click the service and look at the service name field and note the name. It should be something like ”alfrescoTomcat…”.
  3. Open up the [alfresco]tomcatbin folder
  4. Copy the file tomcat7w.exe to [name-of-service]w.exe, e.g. ”alfrescoTomcatw.exe”
  5. Right click on the new exe file and choose Run as administrator
  6. Goto the tab named Java
  7. Enter your JAVA_OPTS under Java Options, e.g:
    -Xms256M
    -Xmx2048M
    -XX:MaxPermSize=1024m
    -Duser.language=sv
    -Duser.region=SE
    -Duser.country=SE
  8. Important: Make sure to remove any spaces at the beginning and the end of the rows above, otherwise it can cause the service to stop working.
  9. Start the Alfresco service

 

An alternative way to set the JAVA_OPTS for the Tomcat Windows service:

If you don’t have a tomcat7w.exe or don’t want to use if for some reason, you can also modify the JAVA_OPTS for the service via registry keys.

  1. Go to Start… Run. Type: regedit.exe.
  2. Locate the folder HKEY_LOCAL_MACHINE > SOFTWARE > Wow6432Node > Apache Software Foundation > Procrun 2.0.
  3. Under Procrun you will see all your installed Tomcat instances. Pick the right one and open it.
  4. Under Parameters > Java, you have a key called Options. Double-click it and put your JAVA_OPTS there.
  5. There may also be DWORD registry keys for JvmMs and JvmMx. Theese correspond to -Xms and -Xmx so change them as well if they are present.

 

2 reaktioner på ”Howto set JAVA_OPTS when Alfresco is running as a Windows service

  • In linux ubuntu 14.04 in the file catalina.sh,
    I have configured as follows:
    JAVA_OPTS=”-XX:MaxPermSize=160m -XX:NewSize=256m -Xms512m ”
    JAVA_OPTS=”$JAVA_OPTS -Xmx2048m -Xss512K ”
    What would be the correct way to add the Spanish leguaje?

    Regards

    • I haven’t tried it out myself but it should be -Duser.language=es -Duser.region=ES -Duser.country=ES for Spanish.

      By the way, I would recommend that you put your arguments in setenv.sh instead of modifying catalina.sh. You also don’t need two lines as in your example. So in your case in setenv.sh (you may need to create it):

      JAVA_OPTS=”$JAVA_OPTS -XX:MaxPermSize=160m -XX:NewSize=256m -Xms512m -Xmx2048m -Xss512K -Duser.language=es -Duser.region=ES -Duser.country=ES”
      export JAVA_OPTS

      Hope that helps!

Kommentera

E-postadressen publiceras inte. Obligatoriska fält är märkta *