APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.launcher

public final Class LauncherHelper

extends Object
Class Inheritance
Imports
java.io.File, .IOException, .PrintStream, .UnsupportedEncodingException, java.lang.module.Configuration, .ModuleDescriptor, .ModuleDescriptor.Exports, .ModuleDescriptor.Opens, .ModuleDescriptor.Provides, .ModuleDescriptor.Requires, .ModuleFinder, .ModuleReference, .ResolvedModule, java.lang.reflect.Constructor, .InvocationTargetException, .Method, .Modifier, java.math.BigDecimal, .RoundingMode, java.net.URI, java.nio.charset.Charset, java.nio.file.DirectoryStream, .Files, .Path, java.text.MessageFormat, .Normalizer, java.util.ArrayList, .Arrays, .Comparator, .Iterator, .List, .Locale, .Locale.Category, .Map, .Optional, .Properties, .ResourceBundle, .Set, .TimeZone, .TreeSet, java.util.function.Function, java.util.jar.Attributes, .JarFile, .Manifest, java.util.stream.Collectors, .Stream, jdk.internal.misc.MethodFinder, .VM, jdk.internal.module.ModuleBootstrap, .Modules, jdk.internal.platform.Container, .Metrics, jdk.internal.util.OperatingSystem, sun.util.calendar.ZoneInfoFile

A utility package for the java(1), javaw(1) launchers. The following are helper methods that the native launcher uses to perform checks etc. using JNI, see src/share/bin/java.c

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class
LauncherHelper.JrtFirstComparator

A ModuleReference comparator that considers modules in the run-time image to be less than modules than not in the run-time image.

pack-priv static enum
private static class
private static enum
private static class

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static Class<?>
private static final String
private static final String
private static final String
private static final String
private static String
private static final String
private static final String
private static boolean
private static boolean
private static final String
private static final String
private static final String
private static final String
private static final String
private static final int
private static final int
private static final int
private static final int
private static final int
private static final String
private static final String
private static boolean
private static PrintStream
private static StringBuilder
private static final String
pack-priv static final boolean
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
abort(Throwable t, String msgKey, Object... args)

pack-priv static void
addExportsOrOpens(String value, boolean open)

Process the Add-Exports or Add-Opens value.

pack-priv static void
appendVmSelectMessage(String vm1, String vm2)

Appends the vm selection messages to the header, already created.

pack-priv static void
appendVmSynonymMessage(String vm1, String vm2)

Appends the vm synonym message to the header, already created.

public static Class<?>

Returns:

the application's main class
checkAndLoadMain
(boolean
if set, all output will be routed to stderr
printToStderr
,
int
LaunchMode as determined by the arguments passed on the command line
mode
,
String
the module name[/class], JAR file, or the main class depending on the mode
what
)

This method: 1.

pack-priv static void
describeModule(String moduleName)

Called by the launcher to describe a module

private static boolean
pack-priv static String[]
expandArgs(String[] argArray)

pack-priv static String[]
private static String
formatCpuVal(long cpuVal, String prefix, long unavailable)

private static String
formatLimitString(long limit, String prefix, long unavailable)

private static String
formatLimitString(long limit, String prefix, long unavailable, boolean scale)

public static Class<?>
private static String
getLocalizedMessage(String key, Object... args)

A private helper method to get a localized message and also apply any arguments that we might pass.

private static String
pack-priv static void
initHelpMessage(String progname)

The java -help message is split into 3 parts, an invariant, followed by a set of platform dependent variant messages, finally an invariant set of lines.

pack-priv static void
initOutput(boolean printToStderr)

pack-priv static void
private static boolean
private static boolean
isJrt(URI uri)

private static boolean
pack-priv static void
listModules()

Called by the launcher to list the observable modules.

private static Class<?>
loadMainClass(int mode, String what)

Loads the main class from the class path (LM_CLASS or LM_JAR).

private static Class<?>
loadModuleMainClass(String what)

Returns the main class for a module.

pack-priv static String
makePlatformString(boolean printToStderr, byte[] inArray)

private static void
printAllSettings(long initialHeapSize, long maxHeapSize, long stackSize, boolean verbose)

pack-priv static void
printConciseUsageMessage(boolean printToStderr)

Prints the short usage text to the desired output stream.

pack-priv static void
printHelpMessage(boolean printToStderr)

Appends the last invariant part to the previously created messages, and finishes up the printing to the desired output stream.

private static void
printLocale(boolean verbose)

private static void
private static void
private static void
private static void
private static void
printVmSettings(long initialHeapSize, long maxHeapSize, long stackSize)

pack-priv static void
printXUsageMessage(boolean printToStderr)

Prints the Xusage text to the desired output stream.

private static void
showModule(ModuleReference mref)

Prints a single line with the module name, version and modifiers

pack-priv static void
showResolvedModules()

Called by the launcher to show the resolved modules

pack-priv static void
showSettings(boolean printToStderr, String optionFlag, long initialHeapSize, long maxHeapSize, long stackSize)

private static <T> Stream<String>
private static void
validateMainMethod(Class<?> mainClass)

private static LauncherHelper.Option
validateOption(String optionFlag)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ADD_EXPORTSback to summary
private static final String ADD_EXPORTS
ADD_OPENSback to summary
private static final String ADD_OPENS
appClassback to summary
private static Class<?> appClass
defaultBundleNameback to summary
private static final String defaultBundleName
diagpropback to summary
private static final String diagprop
ENABLE_FINAL_FIELD_MUTATIONback to summary
private static final String ENABLE_FINAL_FIELD_MUTATION
ENABLE_NATIVE_ACCESSback to summary
private static final String ENABLE_NATIVE_ACCESS
encodingback to summary
private static String encoding
encpropback to summary
private static final String encprop
INDENTback to summary
private static final String INDENT
isCharsetSupportedback to summary
private static boolean isCharsetSupported
isStaticMainback to summary
private static boolean isStaticMain
JAVAFX_APPLICATION_CLASS_NAMEback to summary
private static final String JAVAFX_APPLICATION_CLASS_NAME
JAVAFX_APPLICATION_MARKERback to summary
private static final String JAVAFX_APPLICATION_MARKER
JAVAFX_FXHELPER_CLASS_NAME_SUFFIXback to summary
private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX
JAVAFX_GRAPHICS_MODULE_NAMEback to summary
private static final String JAVAFX_GRAPHICS_MODULE_NAME
LAUNCHER_AGENT_CLASSback to summary
private static final String LAUNCHER_AGENT_CLASS
LM_CLASSback to summary
private static final int LM_CLASS
LM_JARback to summary
private static final int LM_JAR
LM_MODULEback to summary
private static final int LM_MODULE
LM_SOURCEback to summary
private static final int LM_SOURCE
LM_UNKNOWNback to summary
private static final int LM_UNKNOWN
LOCALE_SETTINGSback to summary
private static final String LOCALE_SETTINGS
MAIN_CLASSback to summary
private static final String MAIN_CLASS
noArgMainback to summary
private static boolean noArgMain
ostreamback to summary
private static PrintStream ostream
outBufback to summary
private static StringBuilder outBuf
PROP_SETTINGSback to summary
private static final String PROP_SETTINGS
traceback to summary
pack-priv static final boolean trace
VM_SETTINGSback to summary
private static final String VM_SETTINGS

Constructor Detail

LauncherHelperback to summary
private LauncherHelper()

Method Detail

abortback to summary
pack-priv static void abort(Throwable t, String msgKey, Object... args)
addExportsOrOpensback to summary
pack-priv static void addExportsOrOpens(String value, boolean open)

Process the Add-Exports or Add-Opens value. The value is <module>/<package> ( <module>/<package>)*.

appendVmSelectMessageback to summary
pack-priv static void appendVmSelectMessage(String vm1, String vm2)

Appends the vm selection messages to the header, already created. initHelpSystem must already be called.

appendVmSynonymMessageback to summary
pack-priv static void appendVmSynonymMessage(String vm1, String vm2)

Appends the vm synonym message to the header, already created. initHelpSystem must be called before using this method.

checkAndLoadMainback to summary
public static Class<?> checkAndLoadMain(boolean printToStderr, int mode, String what)

This method: 1. Loads the main class from the module or class path 2. Checks for a valid main method. 3. If the main class extends FX Application then call on FXHelper to perform the launch.

Parameters
printToStderr:boolean

if set, all output will be routed to stderr

mode:int

LaunchMode as determined by the arguments passed on the command line

what:String

the module name[/class], JAR file, or the main class depending on the mode

Returns:Class<?>

the application's main class

describeModuleback to summary
pack-priv static void describeModule(String moduleName)

Called by the launcher to describe a module

doesExtendFXApplicationback to summary
private static boolean doesExtendFXApplication(Class<?> mainClass)
expandArgsback to summary
pack-priv static String[] expandArgs(String[] argArray)
expandArgsback to summary
pack-priv static String[] expandArgs(List<LauncherHelper.StdArg> argList)
formatCpuValback to summary
private static String formatCpuVal(long cpuVal, String prefix, long unavailable)
formatLimitStringback to summary
private static String formatLimitString(long limit, String prefix, long unavailable)
formatLimitStringback to summary
private static String formatLimitString(long limit, String prefix, long unavailable, boolean scale)
getApplicationClassback to summary
public static Class<?> getApplicationClass()
getLocalizedMessageback to summary
private static String getLocalizedMessage(String key, Object... args)

A private helper method to get a localized message and also apply any arguments that we might pass.

getMainClassFromJarback to summary
private static String getMainClassFromJar(JarFile jarFile) throws IOException
initHelpMessageback to summary
pack-priv static void initHelpMessage(String progname)

The java -help message is split into 3 parts, an invariant, followed by a set of platform dependent variant messages, finally an invariant set of lines. This method initializes the help message for the first time, and also assembles the invariant header part of the message.

initOutputback to summary
pack-priv static void initOutput(boolean printToStderr)
initOutputback to summary
pack-priv static void initOutput(PrintStream ps)
isJrtback to summary
private static boolean isJrt(ModuleReference mref)
isJrtback to summary
private static boolean isJrt(URI uri)
isPathback to summary
private static boolean isPath(String key)
listModulesback to summary
pack-priv static void listModules()

Called by the launcher to list the observable modules.

loadMainClassback to summary
private static Class<?> loadMainClass(int mode, String what)

Loads the main class from the class path (LM_CLASS or LM_JAR).

loadModuleMainClassback to summary
private static Class<?> loadModuleMainClass(String what)

Returns the main class for a module. The query is either a module name or module-name/main-class. For the former then the module's main class is obtained from the module descriptor (MainClass attribute).

makePlatformStringback to summary
pack-priv static String makePlatformString(boolean printToStderr, byte[] inArray)
printAllSettingsback to summary
private static void printAllSettings(long initialHeapSize, long maxHeapSize, long stackSize, boolean verbose)
printConciseUsageMessageback to summary
pack-priv static void printConciseUsageMessage(boolean printToStderr)

Prints the short usage text to the desired output stream.

printHelpMessageback to summary
pack-priv static void printHelpMessage(boolean printToStderr)

Appends the last invariant part to the previously created messages, and finishes up the printing to the desired output stream. initHelpSystem must be called before using this method.

printLocaleback to summary
private static void printLocale(boolean verbose)
printLocalesback to summary
private static void printLocales()
printPropertiesback to summary
private static void printProperties()
printPropertyValueback to summary
private static void printPropertyValue(String key, String value)
printSystemMetricsback to summary
private static void printSystemMetrics()
printVmSettingsback to summary
private static void printVmSettings(long initialHeapSize, long maxHeapSize, long stackSize)
printXUsageMessageback to summary
pack-priv static void printXUsageMessage(boolean printToStderr)

Prints the Xusage text to the desired output stream.

showModuleback to summary
private static void showModule(ModuleReference mref)

Prints a single line with the module name, version and modifiers

showResolvedModulesback to summary
pack-priv static void showResolvedModules()

Called by the launcher to show the resolved modules

showSettingsback to summary
pack-priv static void showSettings(boolean printToStderr, String optionFlag, long initialHeapSize, long maxHeapSize, long stackSize)
toStringStreamback to summary
private static <T> Stream<String> toStringStream(Set<T> s)
validateMainMethodback to summary
private static void validateMainMethod(Class<?> mainClass)
validateOptionback to summary
private static LauncherHelper.Option validateOption(String optionFlag)
sun.launcher back to summary

pack-priv final Class LauncherHelper.FXHelper

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static Class<?>
private static Method
private static String
private static String
private static final String
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static void
main(String... args)

private static void
setFXLaunchParameters(String what, int mode)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fxLauncherClassback to summary
private static Class<?> fxLauncherClass
fxLauncherMethodback to summary
private static Method fxLauncherMethod
fxLaunchModeback to summary
private static String fxLaunchMode
fxLaunchNameback to summary
private static String fxLaunchName
JAVAFX_LAUNCH_MODE_CLASSback to summary
private static final String JAVAFX_LAUNCH_MODE_CLASS
JAVAFX_LAUNCH_MODE_JARback to summary
private static final String JAVAFX_LAUNCH_MODE_JAR
JAVAFX_LAUNCH_MODE_MODULEback to summary
private static final String JAVAFX_LAUNCH_MODE_MODULE
JAVAFX_LAUNCHER_CLASS_NAMEback to summary
private static final String JAVAFX_LAUNCHER_CLASS_NAME

Constructor Detail

FXHelperback to summary
pack-priv FXHelper()

Method Detail

mainback to summary
public static void main(String... args) throws Exception
setFXLaunchParametersback to summary
private static void setFXLaunchParameters(String what, int mode)
sun.launcher back to summary

private Class LauncherHelper.JrtFirstComparator

extends Object
implements Comparator<ModuleReference>
Class Inheritance
All Implemented Interfaces
java.util.Comparator

A ModuleReference comparator that considers modules in the run-time image to be less than modules than not in the run-time image.

Field Summary

Modifier and TypeField and Description
private final Comparator<ModuleReference>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
compare(ModuleReference a, ModuleReference b)

Implements java.util.Comparator.compare.

Compares its two arguments for order.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

realback to summary
private final Comparator<ModuleReference> real

Constructor Detail

JrtFirstComparatorback to summary
pack-priv JrtFirstComparator()

Method Detail

compareback to summary
public int compare(ModuleReference a, ModuleReference b)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Annotations
@Override
sun.launcher back to summary

pack-priv final Enum LauncherHelper.Option

extends Enum<LauncherHelper.Option>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option
public static final LauncherHelper.Option

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static LauncherHelper.Option
public static LauncherHelper.Option[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALLback to summary
public static final LauncherHelper.Option ALL
DEFAULTback to summary
public static final LauncherHelper.Option DEFAULT
LOCALEback to summary
public static final LauncherHelper.Option LOCALE
PROPERTIESback to summary
public static final LauncherHelper.Option PROPERTIES
SECURITYback to summary
public static final LauncherHelper.Option SECURITY
SECURITY_ALLback to summary
public static final LauncherHelper.Option SECURITY_ALL
SECURITY_PROPERTIESback to summary
public static final LauncherHelper.Option SECURITY_PROPERTIES
SECURITY_PROVIDERSback to summary
public static final LauncherHelper.Option SECURITY_PROVIDERS
SECURITY_TLSback to summary
public static final LauncherHelper.Option SECURITY_TLS
SYSTEMback to summary
public static final LauncherHelper.Option SYSTEM
VMback to summary
public static final LauncherHelper.Option VM

Constructor Detail

Optionback to summary
private Option()

Method Detail

valueOfback to summary
public static LauncherHelper.Option valueOf(String name)
valuesback to summary
public static LauncherHelper.Option[] values()
sun.launcher back to summary

private Class LauncherHelper.ResourceBundleHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final ResourceBundle

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

RBback to summary
private static final ResourceBundle RB

Constructor Detail

ResourceBundleHolderback to summary
private ResourceBundleHolder()
sun.launcher back to summary

private final Enum LauncherHelper.SizePrefix

extends Enum<LauncherHelper.SizePrefix>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv String
public static final LauncherHelper.SizePrefix
public static final LauncherHelper.SizePrefix
public static final LauncherHelper.SizePrefix
pack-priv long
public static final LauncherHelper.SizePrefix

Constructor Summary

AccessConstructor and Description
private
SizePrefix(long size, String abbrev)

Method Summary

Modifier and TypeMethod and Description
private static String
pack-priv static String
scaleValue(long v)

public static LauncherHelper.SizePrefix
public static LauncherHelper.SizePrefix[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

abbrevback to summary
pack-priv String abbrev
GIGAback to summary
public static final LauncherHelper.SizePrefix GIGA
KILOback to summary
public static final LauncherHelper.SizePrefix KILO
MEGAback to summary
public static final LauncherHelper.SizePrefix MEGA
sizeback to summary
pack-priv long size
TERAback to summary
public static final LauncherHelper.SizePrefix TERA

Constructor Detail

SizePrefixback to summary
private SizePrefix(long size, String abbrev)

Method Detail

scaleback to summary
private static String scale(long v, LauncherHelper.SizePrefix prefix)
scaleValueback to summary
pack-priv static String scaleValue(long v)
valueOfback to summary
public static LauncherHelper.SizePrefix valueOf(String name)
valuesback to summary
public static LauncherHelper.SizePrefix[] values()
sun.launcher back to summary

private Class LauncherHelper.StdArg

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final String
pack-priv final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
StdArg(String arg, boolean expand)

pack-priv

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

argback to summary
pack-priv final String arg
needsExpansionback to summary
pack-priv final boolean needsExpansion

Constructor Detail

StdArgback to summary
pack-priv StdArg(String arg, boolean expand)
StdArgback to summary
pack-priv StdArg(String in)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.