mirror of
https://github.com/FranzHaidnor/haidnorJVM.git
synced 2026-03-14 06:03:50 +08:00
update ClassLoader
This commit is contained in:
@@ -46,7 +46,6 @@ public class ClassLoader {
|
|||||||
public Klass loadClass(String classPath) throws IOException {
|
public Klass loadClass(String classPath) throws IOException {
|
||||||
ClassParser classParser;
|
ClassParser classParser;
|
||||||
if (classPath.startsWith("java/")) {
|
if (classPath.startsWith("java/")) {
|
||||||
String rtJarPath = getRtJarPath();
|
|
||||||
|
|
||||||
if (!new File(rtJarPath).exists()) {
|
if (!new File(rtJarPath).exists()) {
|
||||||
throw new IllegalStateException("rt.jar not found");
|
throw new IllegalStateException("rt.jar not found");
|
||||||
@@ -72,11 +71,4 @@ public class ClassLoader {
|
|||||||
return klass;
|
return klass;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getRtJarPath() {
|
|
||||||
// String javaHome = System.getenv("JAVA_HOME");
|
|
||||||
// Path rtJarPath = Paths.get(javaHome, "jre", "lib", "rt.jar");
|
|
||||||
return rtJarPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ public class Demo4 {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Student student = new Student();
|
Student student = new Student();
|
||||||
student.eat();
|
student.eat();
|
||||||
|
new Thread(() -> {}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user