Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java - entityExpansionLimit. Where do I set this?

Tags:

java

command

csv

I am using Java and when I try to write an array into a CSV file, I encountered the following error:

The parser has encountered more than "64,000" entity expansions

I searched and found that I need to use entityExpansionLimit to solve this by typing in java command line: -DentityExpansionLimit=100000

But being new to Java and these kind of things, I don't understand where am I suppose to type that command. I tried typing that in command prompt but nothing happened

Can someone guide me? Am I supposed to navigate to a specific folder in command prompt?

like image 322
user2741620 Avatar asked Oct 11 '13 16:10

user2741620


1 Answers

With the option -D you can pass a system property to the jvm (see here).

For example if you run you application with

cmd> java -Dfoo=bar MyMainClass

then you can retrieve it in your application using the System#getProperty(String key) like this:

String foo = System.getProperty("foo");
System.out.println(foo); // will print bar

In you case the library that you are using is expecting to find a system property with the name entityExpansionLimit when "entity expansions" has exceeded the value 64,000 but it doesn't find it, i.e System.getProperty("entityExpansionLimit") returns null.

To pass that argument run you application by passing the jvm that system property

cmd> java -DentityExpansionLimit=100000 -cp <your-class-path> YourMainClass
like image 137
A4L Avatar answered Dec 08 '22 23:12

A4L