【发布时间】:2015-02-10 04:33:21
【问题描述】:
Java 运行时环境检测到致命错误:
内部错误 (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, stack(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;
}
}
【问题讨论】:
-
我们实际上无法查看您本地目录中的代码...
-
我可以;他们正在使用 Windows。 Arrrrrrr 你们这些坏血病狗,准备登机。
-
老实说,我认为这不是代码问题。我找到了这个页面:hopper.minecraft.net/help/references/intel-4-series-chipsets 基本上它说我需要一台新计算机或至少一个新 CPU。我现在在我的帖子中添加我的代码。
-
@DaveNewton 小心你进去时不要被感染。否则你会在不知不觉中在 PowerPoint 中设计圣诞贺卡。
-
你是如何运行这个程序的?您是否定义了任何 JVM 标志?您可以尝试使用最新的 Java 版本吗?