feat: use system classloader load jar

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2022-05-15 02:55:57 +08:00
parent 56152657c8
commit dc66290f97
3 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId>
<artifactId>MiaoScript</artifactId>
<version>0.21.1</version>
<version>0.21.2</version>
<developers>
<developer>
<id>502647092</id>

View File

@ -8,7 +8,7 @@ import java.io.File;
import java.nio.file.Paths;
public class MiaoScriptAPI {
public static final String VERSION = "0.21.1";
public static final String VERSION = "0.21.2";
private static String root;
private static String libPath;
private static ScriptEngine scriptEngine;

View File

@ -25,7 +25,7 @@ public class JarLoader {
private static void initReflect() {
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
ClassLoader loader = ClassLoader.getSystemClassLoader();
Field theUnsafe = sun.misc.Unsafe.class.getDeclaredField("theUnsafe");
theUnsafe.setAccessible(true);
sun.misc.Unsafe unsafe = (sun.misc.Unsafe) theUnsafe.get(null);