Java Runtime Environment检测到致命错误:
内部错误(javaClasses.cpp:136),pid = 4816,tid = 4100 致命错误:预加载类的布局无效
JRE版本:(7.0_67-b01)(build) Java VM:Java HotSpot(TM)客户端VM(24.65-b04混合模式windows-x86) 无法编写核心转储。默认情况下,在Windows的客户端版本
上未启用小型转储如果您想提交错误报告,请访问: http://bugreport.sun.com/bugreport/crash.jsp
--------------- T H R E A D ---------------
当前线程(0x011bd400):JavaThread“未知线程”[_thread_in_vm,id = 4100,堆栈(0x01290000,0x012e0000)]
堆栈:[0x01290000,0x012e0000],sp = 0x012df98c,可用空间= 318k 本机帧:(J =已编译的Java代码,j =已解释,Vv = VM代码,C =本机代码) V [jvm.dll + 0x190494] V [jvm.dll + 0x18a116] V [jvm.dll + 0x35d7a] V [jvm.dll + 0x35e06] V [jvm.dll + 0x4465d] V [jvm.dll + 0x4490e] V [jvm.dll + 0x92f8a] V [jvm.dll + 0x9333b] V [jvm.dll + 0x13fa31]
我写了一段代码来读取和搜索XML文件。代码本身没有给我任何错误,但是当我运行它时,代码被终止了。这是我从C:\ Users \ ximinmi \ workspace \ OldImageReveal获得的消息。 OldImageReveal是我正在处理的包。下面是代码。我只是用W3C页面测试它。感谢。
package com.oldimagereveal;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class Search_XML{
public static void main(String[] args) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder;
Document doc = null;
try {
builder = factory.newDocumentBuilder();
doc = builder.parse("http://www.w3schools.com/xml/note.xml");
// Create XPathFactory object
XPathFactory xpathFactory = XPathFactory.newInstance();
// Create XPath object
XPath xpath = xpathFactory.newXPath();
String address = getAddress(doc, xpath, 4);
System.out.println("Image Address is: " + address);
List<String> addresses = getAddresses(doc, xpath, 30);
System.out.println("All addresses are" + Arrays.toString(addresses.toArray()));
} catch (ParserConfigurationException | SAXException | IOException e) {
e.printStackTrace();
}
}
private static List<String> getAddresses(Document doc, XPath xpath, int age) {
List<String> list = new ArrayList<String>();
try {
XPathExpression expr =
xpath.compile("/Records/Record[Address>" + getAddress(doc, xpath, 4) + "]/name/text()");
NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++)
list.add(nodes.item(i).getNodeValue());
} catch (XPathExpressionException e) {
e.printStackTrace();
}
return list;
}
private static String getAddress(Document doc, XPath xpath, int id) {
String name = null;
try {
XPathExpression expr =
xpath.compile("/Records/Record[@id='" + id + "']/name/text()");
name = (String) expr.evaluate(doc, XPathConstants.STRING);
} catch (XPathExpressionException e) {
e.printStackTrace();
}
return name;
}
}
答案 0 :(得分:0)
我知道这篇文章很旧,但是我遇到了同样的问题,我通过更改jdk来解决了这个问题。
在我的情况下,当我尝试使用ecplise运行应用程序时会出现问题,所以我更改了jdk版本,那就是!我正在使用jdk 1.8.0_181,并将其更改为1.8.0_05。