diff --git a/src/main/java/haidnor/jvm/classloader/ClassLoader.java b/src/main/java/haidnor/jvm/classloader/ClassLoader.java index 8517586..f4f37de 100644 --- a/src/main/java/haidnor/jvm/classloader/ClassLoader.java +++ b/src/main/java/haidnor/jvm/classloader/ClassLoader.java @@ -23,17 +23,10 @@ public class ClassLoader { public JarFile jarFile = null; static { - URL resource = ClassLoader.class.getResource("/"); - String path = resource.getPath(); - FileInputStream fis; - try { - fis = new FileInputStream(path + "/haidnorJVM.properties"); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } + InputStream is = ClassLoader.class.getResourceAsStream("/haidnorJVM.properties"); Properties properties = new Properties(); try { - properties.load(fis); + properties.load(is); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/src/test/java/haidnor/jvm/test/TestJVM.java b/src/test/java/haidnor/jvm/test/TestJVM.java index 8b0c62b..41ec9b2 100644 --- a/src/test/java/haidnor/jvm/test/TestJVM.java +++ b/src/test/java/haidnor/jvm/test/TestJVM.java @@ -142,7 +142,7 @@ public class TestJVM { runMainClass(demo_finally_2.class); } - @Test + @Test(expected = ArithmeticException.class) public void demo_finally_3() throws Exception { runMainClass(demo_finally_3.class); }