JAVA_OPTS syntax in catalina.bat directory

I am trying to increase tomcat memory by adding JAVA_OPTS to catalina.bat as follows:

rem TITLE (Optional) Specify the title of Tomcat window. The default rem TITLE is Tomcat if it not specified. rem Example (all one line) rem set TITLE=Tomcat.Cluster#1.Server#1 [%DATE% %TIME%] rem rem rem rem $Id: catalina.bat 1146096 2011-07-13 15:20:43Z markt $ rem --------------------------------------------------------------------------- JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m -Xmx1536m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+DisableExplicitGC -XX:UseConcMarkSweepGC -XX:CMSPermGenSweepingEnabled -XX:CMSClassUnloadingEnabled" 

but I get the following errors in CMD when running startup or shutdown scripts:

 'JAVA_OPTS' is not recognized as an internal or external command, operable program or batch file. '-server' is not recognized as an internal or external command, operable program or batch file. The filename, directory name, or volume label syntax is incorrect. The filename, directory name, or volume label syntax is incorrect. The filename, directory name, or volume label syntax is incorrect. The filename, directory name, or volume label syntax is incorrect. The filename, directory name, or volume label syntax is incorrect. 

please let me know why I receive them.

+4
source share
3 answers

Try:

 set JAVA_OPTS=-Djava.awt.headless=true -Dfile.encoding=UTF-8 ^ -server -Xms1536m -Xmx1536m ^ -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m ^ -XX:MaxPermSize=512m -XX:+DisableExplicitGC ^ -XX:+UseConcMarkSweepGC ^ -XX:+CMSClassUnloadingEnabled 
  • You need to use the set command to set the environment variable.
  • If you want to split the command into several lines in the bat bat file, you need to add ^ (caret) at the end of each line.
  • No quotes required.
+15
source

Try to remove the empty spaces at the end of each new line.

 JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8[ENTER] -server -Xms1536m -Xmx1536m[ENTER] ... 
0
source

Put a backslash at the end of the lines: \ :

 JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 \ -server -Xms1536m -Xmx1536m \ -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m \ -XX:MaxPermSize=512m -XX:+DisableExplicitGC \ -XX:UseConcMarkSweepGC \ -XX:CMSPermGenSweepingEnabled \ -XX:CMSClassUnloadingEnabled" 
-3
source

Source: https://habr.com/ru/post/1391214/


All Articles