Skip to content

Java

On Serv00.com servers Java is available as OpenJDK versions: 11 (default), 1.8 (8), 15, 16, 17, 18 and 19.

Changing Java version

For changing the Java version from the default 11 under the java command, set the variable corresponding to the given version:

export JAVA_VERSION="8"
export JAVA_VERSION="11"
export JAVA_VERSION="15"
export JAVA_VERSION="16"
export JAVA_VERSION="17"
export JAVA_VERSION="18"
export JAVA_VERSION="19"

The following commands are also available: java8, java11, java15, java16, java17, java18 and java19.

RAM

To limit the RAM available for a java process run it with an option -Xms<memory> -Xmx<memory> where <memory> is the amount of memory, for example: 1g, 128m, 1024k.

Additionally, you can use -XX:MetaspaceSize=<memory> -XX:MaxMetaspaceSize=<memory> to set Permanent Generation - the place where class files that are the result of compiled classes and jsp pages are stored. When the maximum space is reached, the Java Virtual Machine starts Full Garbage Collection. When Full Garbage Collection after clearing old classes without references still won't have space for newly generated ones then the Java Virtual Machine shuts down with Out-of-Memory Error (OOME) error.

You can also use the -Xss<memory> parameter to set the stack size for each Java thread. In such a stack are kept: addresses to the memory of objects returned by the function, arguments to the function etc.

See also

GlassFish
Tomcat
WildFly