update ClassLoader

This commit is contained in:
wangxiang
2023-07-21 11:20:44 +08:00
parent 0c478baa17
commit 2e89a8585e
2 changed files with 1 additions and 8 deletions

View File

@@ -46,7 +46,6 @@ public class ClassLoader {
public Klass loadClass(String classPath) throws IOException {
ClassParser classParser;
if (classPath.startsWith("java/")) {
String rtJarPath = getRtJarPath();
if (!new File(rtJarPath).exists()) {
throw new IllegalStateException("rt.jar not found");
@@ -72,11 +71,4 @@ public class ClassLoader {
return klass;
}
private String getRtJarPath() {
// String javaHome = System.getenv("JAVA_HOME");
// Path rtJarPath = Paths.get(javaHome, "jre", "lib", "rt.jar");
return rtJarPath;
}
}

View File

@@ -7,6 +7,7 @@ public class Demo4 {
public static void main(String[] args) {
Student student = new Student();
student.eat();
new Thread(() -> {}).start();
}
}