简体   繁体   English

运行java -version时初始化VM时发生错误

[英]Error occurred during initialization of VM while running java -version

I have jdk (java version 1.8.0_102) included in our perforce stream. 我的perforce流中包含jdk(java版本1.8.0_102)。 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. 我在我的WIndows Server 2008 R2 Service Pack 1计算机上创建了登记,并尝试使用登记中的jdk运行java -version,但它因JVM初始化错误而失败。 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. 如上面的评论所述,问题出在perforce客户端的行结束设置中。 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. 它被设置为'本地',因为我在Windows机器和我们的perforce服务器使用'unix'行结束,它导致从服务器同步到本地机器的罐子中的问题。 I changed the line ending to 'unix' in my perforce client, and that fixed the issue. 我在perforce客户端中将行结尾更改为'unix',这解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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