Hi Team,
Recently upgraded to the 25.12 version of aspose. But I am getting the following error while loading the license. Could you please help us to fix this issue?
Caused by: com.aspose.email.system.exceptions.IOException: Cannot run program “env”: error=1, Operation not permitted
at com.aspose.email.internal.b.zv.g(SourceFile:390) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.b.zv.a(SourceFile:610) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.b.zv.(SourceFile:697) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.n.zn.(Unknown Source) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.n.zn$za.(Unknown Source) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.n.zn.(Unknown Source) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.ai.zdz.o_(Unknown Source) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.zaja.b(SourceFile:271) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.zaja.a(SourceFile:143) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.License.a(SourceFile:349) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.License.setLicense(SourceFile:305) ~[aspose-email-25.12.jar!/:?]
at
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.base/java.lang.reflect.Method.invoke(Method.java:569) ~[?:?]
@Janani009
You reported an issue with loading a license in Aspose.Email for Java 25.12, encountering the error: com.aspose.email.system.exceptions.IOException: Cannot run program "env": error=1, Operation not permitted . This indicates that the library attempts to run the env command during initialization, which is being blocked by your system.
This might be related to changes in how Aspose.Email for Java 25.6+ handles license validation or internal environment checks, as seen in a similar report for version 25.6 and higher .
To address this:
- Confirm that your runtime environment allows executing system commands such as
env.
- If you’re in a restricted environment (e.g., container or sandbox), try loading the license via a file path instead of a stream or resource loader — this may avoid needing to run
env.
- Load the license directly using a file path, for example:
license.setLicense("path/to/license.lic").
If the issue continues, it may point to a bug introduced in version 25.12, and further investigation would be required. Please let us know if the above steps help or if you can successfully load the license using a file path. A support engineer will follow up in this thread if needed.
Yes, I am running the code in the container. I loaded the file as an File Path but still encountering the issue. Below is the stacktrace
Caused by: com.aspose.email.system.exceptions.IOException: Cannot run program “env”: error=1, Operation not permitted
at com.aspose.email.internal.b.zv.g(SourceFile:390) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.b.zv.a(SourceFile:610) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.b.zv.(SourceFile:697) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.n.zn.(Unknown Source) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.n.zn$za.(Unknown Source) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.n.zn.(Unknown Source) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.internal.ai.zdz.o_(Unknown Source) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.zaja.b(SourceFile:271) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.zaja.a(SourceFile:143) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.zaja.a(SourceFile:118) ~[aspose-email-25.12.jar!/:?]
at com.aspose.email.License.setLicense(SourceFile:268) ~[aspose-email-25.12.jar!/:?]
at
@Janani009
You reported encountering the error Cannot run program "env": error=1, Operation not permitted while loading a license in Aspose.Email for Java 25.12 inside a container, even after using a file path .
This happens because the Aspose.Email library tries to run the env system command during license initialization, which is blocked in restricted environments like containers . While loading the license via a file path is typically a workaround to avoid such system calls, it did not resolve your issue .
This problem may be related to changes in how Aspose.Email for Java 25.6+ handles license validation or internal environment checks, as seen in a similar report for version 25.6 and higher .
To proceed:
- Confirm whether your container allows execution of system commands like
env.
- Try loading the license using a stream or resource loader instead of a file path, if possible.
- If the issue persists, it may indicate a bug introduced in version 25.12, and further investigation would be needed.
A support engineer will follow up in this thread if needed.
I tried using the stream as well. But still faces the issue.
@Janani009,
We have opened the following new investigation ticket in our internal issue-tracking system.
Issue ID(s): EMAILJAVA-35434
Could you please provide the update on this Issue?
We are waiting for this.
Hello @Janani009 ,
The issue has been resolved.
The fix will be available in the next release 26.1, which is scheduled for release in early February.
Thank you. Could you please provide the exact date if its planned?
Hello @Janani009 ,
The 26.1 release is scheduled for February 5–6.
Hello @Janani009 ,
We apologize for the delay and thank you for your patience. Release 26.1 has been published.
Thank you, Issue Resolved
I was running into the exact same container error with 25.12. Upgrading to 26.1 as suggested here sorted it out for me too.
@SynthiaCasper,
Good to know, thanks for confirming.