使用此工具https://github.com/citygml4j/citygml-tools,称为to-cityjson。我想将cityGML
文件转换为cityJSON
文件。该文件为4.36 GB,但出现以下错误:
java.lang.OutOfMemoryError
或的UncaughtExceptionHandler
抛出的 main
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at jdk.internal.reflect.GeneratedConstructorAccessor183.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.sun.xml.bind.v2.ClassFactory.create0(ClassFactory.java:102)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.createInstance(ClassBeanInfoImpl.java:255)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:672)
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:158)
at com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:30)
at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$IntercepterLoader.startElement(ElementBeanInfoImpl.java:223)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:547)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:526)
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:45)
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:216)
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:150)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:385)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:356)
at org.citygml4j.builder.jaxb.xml.io.reader.JAXBSimpleReader.nextFeature(JAXBSimpleReader.java:133)
at org.citygml4j.tools.command.ToCityJSONCommand.execute(ToCityJSONCommand.java:133)
at org.citygml4j.tools.CityGMLTools.handleParseResult(CityGMLTools.java:102)
at org.citygml4j.tools.CityGMLTools.handleParseResult(CityGMLTools.java:35)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526)
at org.citygml4j.tools.CityGMLTools.main(CityGMLTools.java:44)
我找到了一种解决方案,那就是使用java -Xmx15G
,但我不知道如何实现。
答案 0 :(得分:2)
您可以使用JAVA_OPTS
可执行文件读取的CITYGML_TOOLS_OPTS
或citygml-tools
环境变量。或者,您可以在DEFAULT_JVM_OPTS
代码中修改citygml-tools
选项:
# Add default JVM options here. You can also use JAVA_OPTS and CITYGML_TOOLS_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xms1G"'
如果您使用的是Linux,则可以在终端中进行设置:
export JAVA_OPTS="-Xmx15G"
citygml-tools <file>
答案 1 :(得分:0)
答案 2 :(得分:0)
您可以尝试使用蛮力方法并分配非常大的健康空间
该行的Grep
defaultJvmOpts = ['-Xms1G']
仅1 GiB的堆空间
还要确保您使用的是64位Java并具有足够的内存