Class JvmUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckVMArgs(String vmArgs) Check that the VM args are valid and safe.dropMissingModules(List<String> vmArgs) Removes modules this JVM lacks from --add-modules: a missing one aborts JVM startup, while --add-exports/--add-opens to a missing module only warn.static StringfindOnPath(String[] bins) Find a binary of the given binaries on PATH.static StringDefined in itw-modularjdk.args.private static String[]https://docs.oracle.com/javase/8/docs/technotes/guides/javaws/developersguide/syntax.html#secure-propertystatic String[]https://docs.oracle.com/javase/9/tools/java.htm#JSWOR624 Java Module VM arguments specified by app developer in jnlp file.private static String[]Returns an array containing the starts of valid (ie safe and supported) arguments for the JVMprivate static String[]Returns an array of valid (ie safe and supported) arguments for the JVM(package private) static booleanisSecurePropertyAValidJVMArg(String argument) Properties set in the JNLP file will normally be set by Web Start after the VM is started but before the application is invoked.(package private) static booleanisSystemModule(String name) private static booleanisValidArgument(String argument) private static booleanisValidConfigArgument(String argument) static booleanisValidSecureProperty(String argument) A secure property is valid if it is in the whitelist or it begins with "jnlp." or "javaws."private static booleanisValidStartingArgument(String argument) static booleanisValidStartingJavaModulesArgument(String argument) mergeJavaModulesVMArgs(List<String> vmArgs) Combines PREDEFINED_JAVA_MODULES_VM_ARGUMENTS with the Java Module VM Args in the input vmargs.moduleArgs(String... args) parseArguments(String args) private static StringpresentModules(String commaList)
-
Field Details
-
LOG
-
VALID_VM_ARGUMENTS
-
VALID_STARTING_ARGUMENTS
-
VALID_STARTING_JAVA_MODULES_ARGUMENTS
-
VALID_SECURE_PROPERTIES
-
WHITESPACE_REGEX
- See Also:
-
KEY_VALUE_SEPARATOR
- See Also:
-
QUOTES
private static final char QUOTES- See Also:
-
configJvmArgsWhitelist
-
ADD_MODULES
- See Also:
-
-
Constructor Details
-
JvmUtils
public JvmUtils()
-
-
Method Details
-
checkVMArgs
Check that the VM args are valid and safe.Based on http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html
- Parameters:
vmArgs- a string containing the args- Throws:
IllegalArgumentException- if the VM arguments are invalid or dangerous
-
isValidArgument
-
isSecurePropertyAValidJVMArg
Properties set in the JNLP file will normally be set by Web Start after the VM is started but before the application is invoked. Some properties are considered "secure" properties and can be passed as -Dkey=value arguments on the java invocation command line. -
isValidStartingArgument
-
isValidStartingJavaModulesArgument
-
isValidSecureProperty
A secure property is valid if it is in the whitelist or it begins with "jnlp." or "javaws."- See Also:
-
getConfigJvmArgsWhitelist
-
isValidConfigArgument
-
getValidVMArguments
Returns an array of valid (ie safe and supported) arguments for the JVMBased on https://docs.oracle.com/javase/8/docs/technotes/guides/javaws/developersguide/syntax.html#secure-property
-
getValidStartingVMArguments
Returns an array containing the starts of valid (ie safe and supported) arguments for the JVMBased on https://docs.oracle.com/javase/8/docs/technotes/guides/javaws/developersguide/syntax.html#secure-property https://docs.oracle.com/en/java/javase/21/docs/specs/man/java.html
-
getValidSecureProperties
https://docs.oracle.com/javase/8/docs/technotes/guides/javaws/developersguide/syntax.html#secure-propertyProperties set in the JNLP file will normally be set by Web Start after the VM is started but before the application is invoked. These properties are considered "secure" properties and can be passed as -Dkey=value arguments on the java invocation command line. The following properties are predefined secure properties and will be passed to the VM in this way.
-
getJavaWsBin
- Returns:
- the javaws binary.
-
findOnPath
-
getValidStartingJavaModuleVMArguments
https://docs.oracle.com/javase/9/tools/java.htm#JSWOR624 Java Module VM arguments specified by app developer in jnlp file. ITW adds its own set of jvm args either throughgetPredefinedJavaModulesVMArgumentsMap()or the itw-modularjdk.args file. These are required for the execution of ITW.Note: --module-path is not accepted by ITW as it would circumvent the classloader and security.
-
getPredefinedJavaModulesVMArgumentsMap
-
moduleArgs
-
dropMissingModules
-
presentModules
-
isSystemModule
-
mergeJavaModulesVMArgs
Combines PREDEFINED_JAVA_MODULES_VM_ARGUMENTS with the Java Module VM Args in the input vmargs. Does not check legality of args, this is done bycheckVMArgs(String)check -
parseArguments
- Throws:
ParseException
-