Skip to content

Commit

Permalink
feat: 可以通过JVM参数指定加载类的mainClass
Browse files Browse the repository at this point in the history
  • Loading branch information
nICEnnnnnnnLee committed Aug 30, 2024
1 parent 40dc3b7 commit 3f9f057
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src-launcher/nicelee/memory/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ public static void main(String[] args) throws FileNotFoundException, IOException

System.out.println(pd.getCodeSource().getLocation().getPath());
MemoryClassLoader mcl = new MemoryClassLoader(pd);
String mainClass = System.getProperty("bilibili.prop.mainClass", "nicelee.ui.FrameMain");
try {
Class<?> clazz = mcl.loadClass("nicelee.ui.FrameMain");
Class<?> clazz = mcl.loadClass(mainClass);
Method method = clazz.getMethod("main", new Class<?>[] { String[].class });
method.invoke(null, (Object) args);
} catch (ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
Expand Down

0 comments on commit 3f9f057

Please sign in to comment.