简体   繁体   中英

Error occurred during initialization of VM while running java -version

I have jdk (java version 1.8.0_102) included in our perforce stream. I created the enlistment on my WIndows Server 2008 R2 Service Pack 1 machine, and tried to run java -version using the jdk from enlistment but it failed with JVM initialization error. Here is the stack trace:

Error occurred during initialization of VM
java.lang.ExceptionInInitializerError
    at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1451)
    at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1436)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    at java.lang.String.charAt(String.java:658)
    at sun.misc.MetaIndex.registerDirectory(MetaIndex.java:184)
    at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java:146)
    at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java:142)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.misc.Launcher$ExtClassLoader.getExtClassLoader(Launcher.java:141)
    at sun.misc.Launcher.<init>(Launcher.java:71)
    at sun.misc.Launcher.<clinit>(Launcher.java:57)
    at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1451)
    at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1436)

Any idea what is wrong?

As mentioned in the comment above, issue was in the line ending setting for the perforce client. It was set to 'local' and since I was on windows machine and our perforce server using 'unix' line ending, it was causing issues in jars synced to local machine from server. I changed the line ending to 'unix' in my perforce client, and that fixed the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM