#! /bin/sh

# Note: the '-Xmx1g' flag is used to set the maximum memory that the java
# program is allowed. When working with large data sets, this number may need
# to be increased based on how much memory you wish to allow weka to have.
# Specifying command line arguments will override the defaults shown here.
# Example: '-Xmx2g'
# '--add-opens java.base/java.lang=ALL-UNNAMED' fixed java.lang.reflect.InaccessibleObjectException:
# java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module
# '-Djava.security.manager=allow' fixed java.lang.InternalError: Failed to invoke main method:
# The Security Manager is deprecated and will be removed in a future release
DEFAULT_ARGS='-Xms32m -Xmx1g --add-opens java.base/java.lang=ALL-UNNAMED -Djava.security.manager=allow'

if [ $# -gt 0 ]; then
	ARGS="$@"
else
	ARGS="$DEFAULT_ARGS"
fi

java $ARGS -jar /usr/share/weka/weka.jar
