After custom Java code files are copied to EBS file system, adcgnjar gets Java error.
$ which adcgnjar
$AD_TOP//bin/adcgnjar
$ adcgnjar
Copyright (c) 2002, 2012 Oracle Corporation
Redwood Shores, California, USA
AD Custom Jar Generation
Version 12.2.0
... ...
About to Generate customall.jar : Fri Sep 26 2025 11:59:42
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at oracle.apps.ad.jri.fwk.ZipFileResourceUnitArea.getResourceUnit(ZipFileResourceUnitArea.java:914)
at oracle.apps.ad.jri.fwk.JRIArchiveOutputUtils.scanAllResourceUnits(JRIArchiveOutputUtils.java:659)
at oracle.apps.ad.jri.fwk.JRIArchiveOutputUtils.updateJRIArchiveZip(JRIArchiveOutputUtils.java:285)
at oracle.apps.ad.jri.fwk.JRIArchiveOutputUtils.writeJRIArchive(JRIArchiveOutputUtils.java:218)
at oracle.apps.ad.jri.adjmx.mergeAndExtract(adjmx.java:1395)
at oracle.apps.ad.jri.adjmx.main(adjmx.java:592)
error:
Failed to generate customall.jar
Restoring customall.bak to customall.jar
The cause can be two reasons:
* Java application has a memory leak. There are tools like YourKit Java Profiler that help to identify such leaks.
* Java application really needs a lot of memory (more than 128 MB by default!). In this case the Java heap size can be increased using the following runtime parameters:
java -Xms<initial heap size> -Xmx<maximum heap size>
Add physical memory to server may not fix the problem. The EBS fix is an env variable, and then run adcgnjar again:
$ export JAVA_TOOL_OPTIONS="-verbose -Xmx2048M -Xms2048M"
The same error may occur in applying a patch by ADOP when "export" the env variable on command line does not avoid the error. The fix is to add that same line to file $APPL_TOP/admin/adovars.env (or custom env file) and then run the main env file.