Resolving "Out of memory" exceptions during Java compilation
Complex schemas can produce a large amount of code, which might cause a java.lang.OutofMemory exception during compilation using Ant. To rectify this:
•Add the environment variable ANT_OPTS, which sets specific Ant options such as the memory to be allocated to the compiler, and set its value as shown below.
•To make sure that the compiler and the generated code run in the same process as Ant, change the fork attribute, in build.xml, to false.
You may need to customize the values depending on the amount of memory in your machine and the size of the project you are working with. For more details, see your Java VM documentation.
When running the ant jar command, you may get an error message similar to "[...] archive contains more than 65535 entities". To prevent this, it is recommended that you use Ant 1.9 or later, and, in the build.xml file, add zip64mode="as-needed" to the <jar> element.
Reserving method names
When customizing code generation using the supplied SPL files, it might be necessary to reserve names to avoid collisions with other symbols. To do this:
|1.||Navigate to subdirectory corresponding to the programming language of the spl subdirectory of the program installation directory e.g. C:\Program Files\Altova\XMLSpy2020\spl\java\.|
|2.||Open the settings.spl file and insert a new line into the reserve section e.g. reserve "myReservedWord".|
|3.||Regenerate the program code.|