Class JvmUtils

java.lang.Object
net.adoptopenjdk.icedteaweb.jvm.JvmUtils

public class JvmUtils extends Object
  • Constructor Details

    • JvmUtils

      public JvmUtils()
  • Method Details

    • checkVMArgs

      public static void checkVMArgs(String vmArgs) throws IllegalArgumentException
      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
    • isValidStartingJavaModulesArgument

      public static boolean isValidStartingJavaModulesArgument(String argument)
    • isValidSecureProperty

      public static boolean isValidSecureProperty(String argument)
      A secure property is valid if it is in the whitelist or it begins with "jnlp." or "javaws."
      See Also:
    • getJavaWsBin

      public static String getJavaWsBin()
      Returns:
      the javaws binary.
    • findOnPath

      public static String findOnPath(String[] bins)
      Find a binary of the given binaries on PATH.
      Parameters:
      bins - list of binaries to look for
      Returns:
      the absolute path to the first binary found
    • getValidStartingJavaModuleVMArguments

      public static String[] 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 through getPredefinedJavaModulesVMArgumentsMap() 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.

    • dropMissingModules

      public static List<String> 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. E.g. JOSM's JNLP asks for javafx.* which plain OpenJDK does not have.
    • mergeJavaModulesVMArgs

      public static List<String> mergeJavaModulesVMArgs(List<String> vmArgs)
      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 by checkVMArgs(String)check
    • parseArguments

      public static List<String> parseArguments(String args) throws ParseException
      Throws:
      ParseException