Writable File Locations after Build and Install process

Hello everyone,
I am tryping to package an existing software called “JHelioviewer”. It is written in java. Since the build only produces a jar file, I made use of makeWrapper to set the class path and other arguments required according to the official build instructions to produce a binary.

Now during runtime, the applications complains that the temporary file location either does not exist or is not writable. I guess that the locations I set them to turn immutable after the build is complete? Java has an option to set the tmpdir, called Djava.io.tmpdir=... but it seems no matter to what I set it, the directory turns to a location that is read only.
I tried locations like /run, /tmp or $TMPDIR

How are problems like this usually addressed in nixos? Below is my wrapper

  installPhase = ''
    ...
    makeWrapper ${jdk22}/bin/java $out/bin/${pname} \
    --add-flags " \
        -cp $out/lib/*:$out/lib/**/*.jar:$out/extra/*:$out/resources/* \
        -Djava.io.tmpdir=/run \
        --add-exports java.desktop/sun.awt=ALL-UNNAMED \
        --add-exports java.desktop/sun.swing=ALL-UNNAMED -jar $out/JHelioviewer.jar" \
  '';

Just for reference, the stack trace in the terminal is

Warning: Caught Exception while retrieving executable temp base directory:
java.io.IOException: Could not determine a temporary executable directory
        at com.jogamp.common.util.IOUtil.getTempDir(IOUtil.java:1335)
        at com.jogamp.common.util.cache.TempFileCache.<clinit>(TempFileCache.java:84)
        at com.jogamp.common.util.cache.TempJarCache.initSingleton(TempJarCache.java:96)
        at com.jogamp.common.os.Platform$1.run(Platform.java:313)
        at com.jogamp.common.util.SecurityUtil.doPrivileged(SecurityUtil.java:80)
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
        at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
        at org.helioviewer.jhv.opengl.GLHelper.createGLCanvas(GLHelper.java:79)
...

while in the GUI, the stack trace is

Message: Couldn't load library 'gluegen_rt' generically including ...
Stacktrace:
java.lang.UnsatisfiedLinkError
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:634)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
at com.jogamp.common.os.Platform$1.run(Platform.java:321)
at com.jogamp.common.util.SecurityUtil.doPrivileged(SecurityUtil.java:80)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
...

So I am a bit confused what exactly the issue is, so I decided to address the one thing first.

You’re going to need to look at the source of that class to figure out how the logic works.

The other issue might be it attempting to use the global dynamic linker which isn’t going to work.