Tmp directory override not working

I am using gradle 7.6 for gradlew for a project. I am speecifying -Djava.io.tmpdir to a different directory other than /tmp but it is not working. My version does not support --gradle-tmpdir and I see it is a non standard option.

I have speecified java.io.tmpdir in my .bashrc file to export it and it is working as I have logged out and back in.

A google search says to do this:

gradle -Djava.io.tmpdir=/path/to/your/tempdir <task_name>

How can I do this for all tasks that I am running?

Doing ./gradlew -Djava.io.tmpdir=/path/to/your/tempdir <task_name> works fine here.
What exactly do you do that it is not working?
If you want to set it for all executions from commandline, you could set GRADLE_OPTS=-Djava.io.tmpdir=... in your .bashrc.

Setting it for all builds also run through IDE I’m not sure whether that is possible.
Setting it via systemProp.java.io.tmpdir in the <GRADLE_USER_HOME>/gradle.properties seems to be evaluated too late.

You could set it via org.gradle.jvmargs=-Djava.io.tmpdir=... in <GRADLE_USER_HOME>/gradle.properties, but then you might miss necessary jvm args set by builds you try to execute, for example if the daemon for those builds needs more heap space.

I did the following

./gradlew -Djava.io.tmpdir=/path/to/your/tempdir <task_name> <task_name> <task_name> <task_name> <task_name>

and it still goes to /tmp instead of /path/to/your/tempdir

Can you show an MCVE?