I am running into trouble with a java program, which attempts to write files to the /tmp directory on Ubuntu 18.10. It runs into errors as it can not write the temporary file it expects. It fails for error 2: No such file or directory. The privileges on /tmp are default.
I have read this is not a problem with Windows or Mac OS for the reason that it would not be restricted in this way.
How do I solve this? Should I configure my system differently (preferred) or alter the code?
Edit:
The file in question is actually created, permissions are
-rwxrwxr-x 1 lucas lucas 51263 Apr 26 11:12 monalisa13902330713449850714bin*
However, the the program cannot find it:
monalisa.tools.tinv.TInvariantCalculator$InvokeProcessException: java.io.IOException: Cannot run program "/tmp/monalisa13902330713449850714bin" (in directory "/tmp"): error=2, No such file or directory
The /tmp directory is determined correctly by File(System.getProperty("java.io.tmpdir"));
The file is created here:
toolFile = FileUtils.extractResource("tinv_unix", "monalisa", "bin");
public static File extractResource(URL resource, String prefix,
String suffix) throws IOException {
LOGGER.debug("Extracting resource '" + resource.toString() + "'");
File file = File.createTempFile(prefix, suffix);
file.setExecutable(true, false);
Running exec /tmp/[file name] returns the same error.