public final class AppNameUtil extends Object
project.name from System Properties, if not null, use the value as app name;sun.java.command from System properties, remove path, arguments and ".jar" or ".JAR"
suffix, use the result as app name. Note that whitespace in file name or path is not allowed, or a
wrong app name may be gotten, For example:
"test.Main" -> test.Main
"/target/test.Main" -> test.Main
"/target/test.Main args1" -> test.Main
"Main.jar" -> Main
"/target/Main.JAR args1" -> Main
"Mai n.jar" -> Mai // whitespace in file name is not allowed
| Modifier and Type | Field and Description |
|---|---|
static String |
APP_NAME |
static String |
SUN_JAVA_COMMAND |
| Modifier and Type | Method and Description |
|---|---|
static String |
getAppName() |
static void |
resolveAppName() |
public static final String APP_NAME
public static final String SUN_JAVA_COMMAND
public static void resolveAppName()
public static String getAppName()
Copyright © 2019 Alibaba Group. All rights reserved.