Remove MaxPermSize warning from JBoss EAP

If you have JBoss EAP or Wildfly and you are using Java 8, you will receive in the logs, this warning:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

Java 8 eliminates above option, so the warning is ok. You can ignore it or remove it from the standalone.conf under $JBOSS/bin. To remove it, I will use awk to substitute the option with an empty string.

The content of my demo file:

vinh@foha03:~> cat standalone.test
JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true"

The basic awk syntax:

awk '{gsub("word", "");print}' input
awk '{gsub("regex", "");print}' input > output
vinh@foha03:~> awk '{gsub("-XX:MaxPermSize=256m ", "");print}' standalone.test
JAVA_OPTS="-Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true"

To replace it with JBoss EAP standalone.conf

cp $JBOSS/bin/standalone.conf $JBOSS/bin/standalone-cfg.backup
awk '{gsub("-XX:MaxPermSize=256m ", "");print}' $JBOSS/bin/standalone-cfg.backup > $JBOSS/bin/standalone.conf