Last active
December 29, 2015 07:49
-
-
Save yasuflatland-lf/7638555 to your computer and use it in GitHub Desktop.
This code will crash JVM to invoke with following parameter.java -Xbootclasspath/p:. Crash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sun.misc.Unsafe; | |
| import java.lang.reflect.Field; | |
| public class Crash { | |
| public static void main(String... args) throws Exception { | |
| getUnsafe().getByte(0); | |
| } | |
| private static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException { | |
| Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); | |
| theUnsafe.setAccessible(true); | |
| return (Unsafe) theUnsafe.get(null); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment